feat: support redis sentinel
This commit is contained in:
@@ -1,14 +1,30 @@
|
||||
import appConfig from './app.js';
|
||||
|
||||
const redisConfig = {
|
||||
host: appConfig.redisHost,
|
||||
port: appConfig.redisPort,
|
||||
username: appConfig.redisUsername,
|
||||
password: appConfig.redisPassword,
|
||||
db: appConfig.redisDb,
|
||||
enableOfflineQueue: false,
|
||||
enableReadyCheck: true,
|
||||
};
|
||||
|
||||
if (appConfig.redisSentinelHost) {
|
||||
redisConfig.sentinels = [
|
||||
{
|
||||
host: appConfig.redisSentinelHost,
|
||||
port: appConfig.redisSentinelPort,
|
||||
}
|
||||
];
|
||||
|
||||
redisConfig.sentinelUsername = appConfig.redisSentinelUsername;
|
||||
redisConfig.sentinelPassword = appConfig.redisSentinelPassword;
|
||||
redisConfig.name = appConfig.redisName;
|
||||
redisConfig.role = appConfig.redisRole;
|
||||
} else {
|
||||
redisConfig.host = appConfig.redisHost;
|
||||
redisConfig.port = appConfig.redisPort;
|
||||
}
|
||||
|
||||
if (appConfig.redisTls) {
|
||||
redisConfig.tls = {};
|
||||
}
|
||||
|
Reference in New Issue
Block a user