Skip to content

Commit 55858cf

Browse files
committed
feat: REDIS_TLS=true env variable support
1 parent 40a36d5 commit 55858cf

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

packages/cubejs-query-orchestrator/orchestrator/RedisFactory.js

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,22 @@ const { promisify } = require('util');
44
module.exports = function createRedisClient(url) {
55
redis.Multi.prototype.execAsync = promisify(redis.Multi.prototype.exec);
66

7-
const client = redis.createClient(url);
7+
let options;
8+
9+
if (process.env.REDIS_TLS === 'true') {
10+
options = {
11+
url,
12+
tls: {}
13+
};
14+
}
15+
16+
const client = redis.createClient(options || url);
817

918
['brpop', 'del', 'get', 'hget', 'rpop', 'set', 'zadd', 'zrange', 'zrangebyscore'].forEach(
10-
k => client[`${k}Async`] = promisify(client[k])
19+
k => {
20+
client[`${k}Async`] = promisify(client[k]);
21+
}
1122
);
1223

1324
return client;
14-
}
25+
};

0 commit comments

Comments
 (0)