|
|
|
@ -18,7 +18,15 @@ exports.Databases = { |
|
|
|
exports.SEPARATOR = SEPARATOR |
|
|
|
|
|
|
|
exports.getRedisOptions = (clustered = false) => { |
|
|
|
const [host, port] = REDIS_URL.split(":") |
|
|
|
const [host, port, ...rest] = REDIS_URL.split(":") |
|
|
|
|
|
|
|
let redisProtocolUrl |
|
|
|
|
|
|
|
// fully qualified redis URL
|
|
|
|
if (rest.length && /rediss?/.test(host)) { |
|
|
|
redisProtocolUrl = REDIS_URL |
|
|
|
} |
|
|
|
|
|
|
|
const opts = { |
|
|
|
connectTimeout: CONNECT_TIMEOUT_MS, |
|
|
|
} |
|
|
|
@ -33,7 +41,7 @@ exports.getRedisOptions = (clustered = false) => { |
|
|
|
opts.port = port |
|
|
|
opts.password = REDIS_PASSWORD |
|
|
|
} |
|
|
|
return { opts, host, port } |
|
|
|
return { opts, host, port, redisProtocolUrl } |
|
|
|
} |
|
|
|
|
|
|
|
exports.addDbPrefix = (db, key) => { |
|
|
|
|