feat: 增加了env中配置redis db 的选项
This commit is contained in:
parent
cfdbc273a7
commit
8b556319b7
7
src/utils/cache/redis.js
vendored
7
src/utils/cache/redis.js
vendored
@ -21,16 +21,19 @@ const redisInit = async function() {
|
|||||||
const RDS_HOST = conf.redis_host;
|
const RDS_HOST = conf.redis_host;
|
||||||
const RDS_PORT = conf.redis_port;
|
const RDS_PORT = conf.redis_port;
|
||||||
const RDS_PWD = conf.redis_password;
|
const RDS_PWD = conf.redis_password;
|
||||||
|
const RDS_DB = conf.redis_db;
|
||||||
const RDS_OPTS = {
|
const RDS_OPTS = {
|
||||||
auth_pass: RDS_PWD,
|
auth_pass: RDS_PWD,
|
||||||
};
|
};
|
||||||
|
|
||||||
if(RDS_PWD){
|
if(RDS_PWD){
|
||||||
redisClientInstance = createClient({
|
redisClientInstance = createClient({
|
||||||
url: `redis://:${RDS_PWD}@${RDS_HOST}:${RDS_PORT}/0`,
|
url: `redis://:${RDS_PWD}@${RDS_HOST}:${RDS_PORT}/${RDS_DB}`,
|
||||||
});
|
});
|
||||||
}else{
|
}else{
|
||||||
redisClientInstance = createClient({});
|
redisClientInstance = createClient({
|
||||||
|
url: `redis://${RDS_HOST}:${RDS_PORT}/${RDS_DB}`,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
redisClientInstance.on('error', err => {
|
redisClientInstance.on('error', err => {
|
||||||
|
|||||||
@ -21,6 +21,8 @@ tl_rtc_app_redis_host=localhost
|
|||||||
tl_rtc_app_redis_port=6379
|
tl_rtc_app_redis_port=6379
|
||||||
## redis auth密码
|
## redis auth密码
|
||||||
tl_rtc_app_redis_password=
|
tl_rtc_app_redis_password=
|
||||||
|
## redis db 默认0
|
||||||
|
tl_rtc_app_redis_db=0
|
||||||
|
|
||||||
|
|
||||||
#-----------------以下为webrtc相关配置-----------------#
|
#-----------------以下为webrtc相关配置-----------------#
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user