Skip to content
Snippets Groups Projects
Commit c9fe3b80 authored by Xiao Gui's avatar Xiao Gui Committed by xgui3783
Browse files

chore: simplify redis credential

parent f568c91d
No related branches found
No related tags found
No related merge requests found
......@@ -32,15 +32,7 @@ const redisPort = REDIS_PORT || REDIS_RATE_LIMITING_DB_EPHEMERAL_PORT_6379_TCP_P
* nb this way to set username and pswd can be risky, but given that site adnimistrator sets the username and pswd via env var
* it should not be a security concern
*/
const userPass = (() => {
let outstring = ''
if (!REDIS_USERNAME && !REDIS_PASSWORD) return outstring
if (REDIS_USERNAME) outstring += REDIS_USERNAME
if (outstring.length > 0) outstring += ':'
if (REDIS_PASSWORD) outstring += REDIS_PASSWORD
if (outstring.length > 0) outstring += '@'
return outstring
})()
const userPass = (REDIS_USERNAME || REDIS_PASSWORD) && `${REDIS_USERNAME || ''}${REDIS_USERNAME ? ':' : ''}${REDIS_PASSWORD || ''}@`
const redisURL = redisAddr && `${redisProto}://${userPass || ''}${redisAddr}:${redisPort}`
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment