feat: make it simpler to use redis sentinels

isekai-main
Barış Soner Uşaklı 3 years ago
parent d98ca43799
commit 82389469f6

@ -14,6 +14,11 @@ connection.connect = async function (options) {
let cxn; let cxn;
if (options.cluster) { if (options.cluster) {
cxn = new Redis.Cluster(options.cluster, options.options); cxn = new Redis.Cluster(options.cluster, options.options);
} else if (options.sentinels) {
cxn = new Redis({
sentinels: options.sentinels,
...options.options,
});
} else if (redis_socket_or_host && String(redis_socket_or_host).indexOf('/') >= 0) { } else if (redis_socket_or_host && String(redis_socket_or_host).indexOf('/') >= 0) {
// If redis.host contains a path name character, use the unix dom sock connection. ie, /tmp/redis.sock // If redis.host contains a path name character, use the unix dom sock connection. ie, /tmp/redis.sock
cxn = new Redis({ cxn = new Redis({

Loading…
Cancel
Save