diff --git a/deploy/saneUrl/index.js b/deploy/saneUrl/index.js index d39c2cb2b96bea55fee864691b89ba63b5a73dd9..7d8a79ef6700bcd2649fd288b7d53b16ef1baffe 100644 --- a/deploy/saneUrl/index.js +++ b/deploy/saneUrl/index.js @@ -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}`