1
0
Fork 0
mirror of https://github.com/mastodon/mastodon.git synced 2024-08-20 21:08:15 -07:00
This commit is contained in:
CSDUMMI 2024-07-31 14:05:07 +00:00 committed by GitHub
commit 1e554d2b26
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -241,16 +241,16 @@ const redisConfigFromEnv = (env) => {
// which means we can't use it. But this is something that should be looked into.
const redisPrefix = env.REDIS_NAMESPACE ? `${env.REDIS_NAMESPACE}:` : '';
let redisPort = parseIntFromEnv(env.REDIS_PORT, 6379, 'REDIS_PORT');
let redisDatabase = parseIntFromEnv(env.REDIS_DB, 0, 'REDIS_DB');
/** @type {import('ioredis').RedisOptions} */
const redisParams = {
const redisParams = typeof env.REDIS_URL !== 'string' ? {
host: env.REDIS_HOST || '127.0.0.1',
port: redisPort,
db: redisDatabase,
port: parseIntFromEnv(env.REDIS_PORT, 6379, 'REDIS_PORT'),
db: parseIntFromEnv(env.REDIS_DB, 0, 'REDIS_DB'),
password: env.REDIS_PASSWORD || undefined,
};
} : {};
// redisParams.path takes precedence over host and port.
if (env.REDIS_URL && env.REDIS_URL.startsWith('unix://')) {