ActivityPub-federated video streaming platform using P2P directly in your web browser
Fix Redis Sentinel support (#7365)
q0ntinuum327a011df190
diff --git a/config/default.yaml b/config/default.yamlindex dce95440c8..8d3a5cd969 100644--- a/config/default.yaml+++ b/config/default.yaml@@ -93,14 +93,15 @@ database:redis:hostname: '127.0.0.1'port: 6379- auth: null # Used by both standalone and sentinel+ auth: nulldb: 0sentinel:enabled: falseenable_tls: falsemaster_name: ''+ password: ''sentinels:- - hostname: ''+ - host: ''port: 26379# SMTP server to send emailsdiff --git a/config/production.yaml.example b/config/production.yaml.exampleindex 908f6f41d0..f9bb033f0d 100644--- a/config/production.yaml.example+++ b/config/production.yaml.example@@ -91,14 +91,15 @@ database:redis:hostname: '127.0.0.1'port: 6379- auth: null # Used by both standalone and sentinel+ auth: nulldb: 0sentinel:enabled: falseenable_tls: falsemaster_name: ''+ password: ''sentinels:- - hostname: ''+ - host: ''port: 26379# SMTP server to send emailsdiff --git a/server/core/initializers/checker-before-init.ts b/server/core/initializers/checker-before-init.tsindex 7e2c32bbf9..a87ef74783 100644--- a/server/core/initializers/checker-before-init.ts+++ b/server/core/initializers/checker-before-init.ts@@ -269,7 +269,7 @@ export function checkMissedConfig () {[ // set[ 'redis.hostname', 'redis.port' ], // alternative[ 'redis.socket' ],- [ 'redis.sentinel.master_name', 'redis.sentinel.sentinels[0].hostname', 'redis.sentinel.sentinels[0].port' ]+ [ 'redis.sentinel.master_name', 'redis.sentinel.sentinels[0].host', 'redis.sentinel.sentinels[0].port' ]]]const miss: string[] = []diff --git a/server/core/initializers/config.ts b/server/core/initializers/config.tsindex 21a788921f..3fa3ecc501 100644--- a/server/core/initializers/config.ts+++ b/server/core/initializers/config.ts@@ -53,8 +53,9 @@ const CONFIG = {SENTINEL: {ENABLED: config.has('redis.sentinel.enabled') ? config.get<boolean>('redis.sentinel.enabled') : false,ENABLE_TLS: config.has('redis.sentinel.enable_tls') ? config.get<boolean>('redis.sentinel.enable_tls') : false,- SENTINELS: config.has('redis.sentinel.sentinels') ? config.get<{ hostname: string, port: number }[]>('redis.sentinel.sentinels') : [],- MASTER_NAME: config.has('redis.sentinel.master_name') ? config.get<string>('redis.sentinel.master_name') : null+ SENTINELS: config.has('redis.sentinel.sentinels') ? config.get<{ host: string, port: number }[]>('redis.sentinel.sentinels') : [],+ MASTER_NAME: config.has('redis.sentinel.master_name') ? config.get<string>('redis.sentinel.master_name') : null,+ PASSWORD: config.has('redis.sentinel.password') ? config.get<string>('redis.sentinel.password') : null}},SMTP: {diff --git a/server/core/lib/redis.ts b/server/core/lib/redis.tsindex ed2f9c9034..937c8e34c0 100644--- a/server/core/lib/redis.ts+++ b/server/core/lib/redis.ts@@ -75,7 +75,8 @@ class Redis {connectionName,connectTimeout,enableTLSForSentinelMode: CONFIG.REDIS.SENTINEL.ENABLE_TLS,- sentinelPassword: CONFIG.REDIS.AUTH,+ sentinelPassword: CONFIG.REDIS.SENTINEL.PASSWORD,+ password: CONFIG.REDIS.AUTH,sentinels: CONFIG.REDIS.SENTINEL.SENTINELS,name: CONFIG.REDIS.SENTINEL.MASTER_NAME,...options