Improve redis config

This commit is contained in:
syuilo 2019-03-09 23:44:54 +09:00
parent 948a133b7b
commit 5a0a297634
No known key found for this signature in database
GPG Key ID: BDC4C49D06AB9D69
3 changed files with 8 additions and 3 deletions

View File

@ -19,6 +19,8 @@ export type Source = {
host: string; host: string;
port: number; port: number;
pass: string; pass: string;
db?: number;
prefix?: string;
}; };
elasticsearch: { elasticsearch: {
host: string; host: string;

View File

@ -5,6 +5,8 @@ export default config.redis ? redis.createClient(
config.redis.port, config.redis.port,
config.redis.host, config.redis.host,
{ {
auth_pass: config.redis.pass auth_pass: config.redis.pass,
prefix: config.redis.prefix,
db: config.redis.db || 0
} }
) : null; ) : null;

View File

@ -16,8 +16,9 @@ function initializeQueue(name: string) {
port: config.redis.port, port: config.redis.port,
host: config.redis.host, host: config.redis.host,
password: config.redis.pass, password: config.redis.pass,
db: 1 db: config.redis.db || 0,
} },
prefix: config.redis.prefix ? `${config.redis.prefix}:queue` : 'queue'
} : null); } : null);
} }