Skip to content

Commit

Permalink
Merge pull request #10 from logandavis/logan/tls
Browse files Browse the repository at this point in the history
feat(encryption): support rediss:// connection strings
  • Loading branch information
ttacon authored Feb 2, 2020
2 parents 1b1085c + 1a92d15 commit 91d9e72
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion repl.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,17 @@ class Combee {
assert(config.redisUrl, 'must provide redis URL');
assert(config.queues || config.queuePrefix, 'must provide queues');

this.redis = redis.createClient(config.redisUrl);
let redisConnection = config.redisUrl;
if (config.redisUrl.startsWith('rediss:')) {
// A rediss:// URL means in-transit encryption is enabled for the redis host, so use TLS.
redisConnection = {
url: redisConnection.replace('rediss:', 'redis:'),
tls: {},
};
};

this.redis = redis.createClient(redisConnection);

this.redis.on('error', function(err) {
console.log(err);
});
Expand Down

0 comments on commit 91d9e72

Please sign in to comment.