From 45c5457cc91183bc515127c38d1159939b0be2fa Mon Sep 17 00:00:00 2001 From: "andrei.artiukhov" Date: Fri, 4 Oct 2024 17:04:48 -0400 Subject: [PATCH] feat(queue): handle redis url starting with rediss scheme by specifying tls as empty object --- lib/queue.js | 4 ++++ test/test_queue.js | 10 ++++++++++ 2 files changed, 14 insertions(+) diff --git a/lib/queue.js b/lib/queue.js index 19eefc35d..8a1093368 100755 --- a/lib/queue.js +++ b/lib/queue.js @@ -346,6 +346,10 @@ function redisOptsFromUrl(urlString) { } } + if (redisUrl.protocol && redisUrl.protocol.startsWith('rediss')) { + redisOpts.tls = {}; + } + if (redisUrl.query) { redisOpts = { ...redisOpts, ...redisUrl.query }; } diff --git a/test/test_queue.js b/test/test_queue.js index c57668a99..178a5b667 100644 --- a/test/test_queue.js +++ b/test/test_queue.js @@ -223,6 +223,16 @@ describe('Queue', () => { return queue.close(); }); + it('creates a queue using the supplied redis url that contains rediss protocol', () => { + const queue = new Queue('custom', { + redis: 'rediss://abc:123@127.2.3.4:1234/1' + }); + + expect(queue.client.options.tls).to.be.eql({}); + + return queue.close(); + }); + it('creates a queue using the supplied redis host', () => { const queue = new Queue('custom', { redis: { host: 'localhost' } });