let realtimedb-help build redis configuraiton from env variables (#256)

* let realtimedb-help build redis configuraiton from env variables

* update speech-utils version
This commit is contained in:
Hoan Luu Huu
2023-11-14 08:57:16 -05:00
committed by GitHub
parent 0f244cf6d5
commit a474c2d4cc
4 changed files with 14 additions and 46 deletions
+2 -30
View File
@@ -1,29 +1,5 @@
const logger = require('../logger');
const JAMBONES_REDIS_SENTINELS = process.env.JAMBONES_REDIS_SENTINELS ? {
sentinels: process.env.JAMBONES_REDIS_SENTINELS.split(',').map((sentinel) => {
let host, port = 26379;
if (sentinel.includes(':')) {
const arr = sentinel.split(':');
host = arr[0];
port = parseInt(arr[1], 10);
} else {
host = sentinel;
}
return {host, port};
}),
name: process.env.JAMBONES_REDIS_SENTINEL_MASTER_NAME,
...(process.env.JAMBONES_REDIS_SENTINEL_PASSWORD && {
password: process.env.JAMBONES_REDIS_SENTINEL_PASSWORD
}),
...(process.env.JAMBONES_REDIS_SENTINEL_USERNAME && {
username: process.env.JAMBONES_REDIS_SENTINEL_USERNAME
}),
...(process.env.JAMBONES_REDIS_SENTINEL_SENTINAL_PASSWORD && {
sentinelPassword: process.env.JAMBONES_REDIS_SENTINEL_SENTINAL_PASSWORD
}),
} : null;
const {
client,
retrieveCall,
@@ -37,10 +13,7 @@ const {
deleteKey,
incrKey,
client: redisClient,
} = require('@jambonz/realtimedb-helpers')(JAMBONES_REDIS_SENTINELS || {
host: process.env.JAMBONES_REDIS_HOST || 'localhost',
port: process.env.JAMBONES_REDIS_PORT || 6379
}, logger);
} = require('@jambonz/realtimedb-helpers')({}, logger);
module.exports = {
client,
@@ -54,6 +27,5 @@ module.exports = {
retrieveKey,
deleteKey,
redisClient,
incrKey,
JAMBONES_REDIS_SENTINELS
incrKey
};