1
0
mirror of https://github.com/redis/node-redis.git synced 2025-08-09 00:22:08 +03:00

feat: add support for rediss protocol in url

This commit is contained in:
calebboyd
2017-10-27 16:32:33 -05:00
committed by Ruben Bridgewater
parent 2a586e35b6
commit 5d6e471d0c
3 changed files with 29 additions and 2 deletions

View File

@@ -32,7 +32,11 @@ module.exports = function createClient (port_arg, host_arg, options) {
options.password = parsed.auth.split(':')[1];
}
if (parsed.protocol && parsed.protocol !== 'redis:') {
console.warn('node_redis: WARNING: You passed "' + parsed.protocol.substring(0, parsed.protocol.length - 1) + '" as protocol instead of the "redis" protocol!');
if (parsed.protocol === 'rediss:') {
options.tls = options.tls || {};
} else {
console.warn('node_redis: WARNING: You passed "' + parsed.protocol.substring(0, parsed.protocol.length - 1) + '" as protocol instead of the "redis" protocol!');
}
}
if (parsed.pathname && parsed.pathname !== '/') {
options.db = parsed.pathname.substr(1);