enabling cluster support for ratelimit cache

This commit is contained in:
Martin McKeaveney 2023-04-28 20:23:39 +01:00
parent e75e91e248
commit 36397bb77d
2 changed files with 7 additions and 2 deletions

View File

@ -42,8 +42,12 @@ if (!env.isTest()) {
host: REDIS_OPTS.host,
port: REDIS_OPTS.port,
},
password: REDIS_OPTS.opts.password,
database: 1,
password: REDIS_OPTS.opts.password || REDIS_OPTS.opts.redisOptions.password,
}
if (!env.REDIS_CLUSTERED) {
// Can't set direct redis db in clustered env
options.database = 1
}
}
rateLimitStore = new Stores.Redis(options)

View File

@ -47,6 +47,7 @@ const environment = {
MINIO_SECRET_KEY: process.env.MINIO_SECRET_KEY,
REDIS_URL: process.env.REDIS_URL,
REDIS_PASSWORD: process.env.REDIS_PASSWORD,
REDIS_CLUSTERED: process.env.REDIS_CLUSTERED,
HTTP_MIGRATIONS: process.env.HTTP_MIGRATIONS,
API_REQ_LIMIT_PER_SEC: process.env.API_REQ_LIMIT_PER_SEC,
GOOGLE_CLIENT_ID: process.env.GOOGLE_CLIENT_ID,