Add REDIS_USER and REDIS_DB configuration variables
See https://github.com/timvisee/send/issues/23#issuecomment-843925819
This commit is contained in:
parent
e5d7378fd9
commit
175712cfbd
3 changed files with 16 additions and 2 deletions
|
@ -89,11 +89,21 @@ const conf = convict({
|
|||
default: 6379,
|
||||
env: 'REDIS_PORT'
|
||||
},
|
||||
redis_user: {
|
||||
format: String,
|
||||
default: '',
|
||||
env: 'REDIS_USER'
|
||||
},
|
||||
redis_password: {
|
||||
format: String,
|
||||
default: '',
|
||||
env: 'REDIS_PASSWORD'
|
||||
},
|
||||
redis_db: {
|
||||
format: String,
|
||||
default: '',
|
||||
env: 'REDIS_DB'
|
||||
},
|
||||
redis_event_expire: {
|
||||
format: Boolean,
|
||||
default: false,
|
||||
|
|
|
@ -21,8 +21,12 @@ module.exports = function(config) {
|
|||
return config.redis_retry_delay;
|
||||
}
|
||||
};
|
||||
if (config.redis_user != null && config.redis_user.length > 0)
|
||||
client_config.user = config.redis_user;
|
||||
if (config.redis_password != null && config.redis_password.length > 0)
|
||||
client_config.password = config.redis_password;
|
||||
if (config.redis_db != null && config.redis_db.length > 0)
|
||||
client_config.db = config.redis_db;
|
||||
const client = redis.createClient(client_config);
|
||||
|
||||
client.ttlAsync = promisify(client.ttl);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue