feat: support redis sentinel
This commit is contained in:
@@ -66,10 +66,17 @@ const appConfig = {
|
||||
appSecretKey: process.env.APP_SECRET_KEY || '',
|
||||
serveWebAppSeparately,
|
||||
redisHost: process.env.REDIS_HOST || '127.0.0.1',
|
||||
redisName: process.env.REDIS_NAME || 'mymaster',
|
||||
redisPort: parseInt(process.env.REDIS_PORT || '6379'),
|
||||
redisUsername: process.env.REDIS_USERNAME,
|
||||
redisPassword: process.env.REDIS_PASSWORD,
|
||||
redisDb: parseInt(process.env.REDIS_DB || '0'),
|
||||
redisRole: process.env.REDIS_ROLE || 'master',
|
||||
redisTls: process.env.REDIS_TLS === 'true',
|
||||
redisSentinelHost: process.env.REDIS_SENTINEL_HOST,
|
||||
redisSentinelUsername: process.env.REDIS_SENTINEL_USERNAME,
|
||||
redisSentinelPassword: process.env.REDIS_SENTINEL_PASSWORD,
|
||||
redisSentinelPort: parseInt(process.env.REDIS_SENTINEL_PORT || '26379'),
|
||||
enableBullMQDashboard: process.env.ENABLE_BULLMQ_DASHBOARD === 'true',
|
||||
bullMQDashboardUsername: process.env.BULLMQ_DASHBOARD_USERNAME,
|
||||
bullMQDashboardPassword: process.env.BULLMQ_DASHBOARD_PASSWORD,
|
||||
|
@@ -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