diff --git a/src/config/types.ts b/src/config/types.ts index 51b76262a9..5f30d410c9 100644 --- a/src/config/types.ts +++ b/src/config/types.ts @@ -19,6 +19,8 @@ export type Source = { host: string; port: number; pass: string; + db?: number; + prefix?: string; }; elasticsearch: { host: string; diff --git a/src/db/redis.ts b/src/db/redis.ts index 48e3f4e43e..cebf2a10af 100644 --- a/src/db/redis.ts +++ b/src/db/redis.ts @@ -5,6 +5,8 @@ export default config.redis ? redis.createClient( config.redis.port, config.redis.host, { - auth_pass: config.redis.pass + auth_pass: config.redis.pass, + prefix: config.redis.prefix, + db: config.redis.db || 0 } ) : null; diff --git a/src/queue/index.ts b/src/queue/index.ts index eccb38b5e2..83cebe247b 100644 --- a/src/queue/index.ts +++ b/src/queue/index.ts @@ -16,8 +16,9 @@ function initializeQueue(name: string) { port: config.redis.port, host: config.redis.host, password: config.redis.pass, - db: 1 - } + db: config.redis.db || 0, + }, + prefix: config.redis.prefix ? `${config.redis.prefix}:queue` : 'queue' } : null); }