Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(queue): handle redis url starting with rediss scheme by specifying tls as empty object #2776

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions lib/queue.js
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,10 @@ function redisOptsFromUrl(urlString) {
}
}

if (redisUrl.protocol && redisUrl.protocol.startsWith('rediss')) {
redisOpts.tls = {};
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good change. Default should be to use TLS for rediss protocol, and you can still disable that with query string options like tls=false.


if (redisUrl.query) {
redisOpts = { ...redisOpts, ...redisUrl.query };
}
Expand Down
10 changes: 10 additions & 0 deletions test/test_queue.js
Original file line number Diff line number Diff line change
Expand Up @@ -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:[email protected]: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' } });

Expand Down