improve redis auth

This commit is contained in:
SrGooglo 2023-07-05 19:06:25 +00:00
parent 5e29f2fa7e
commit 0d3650e03f

View File

@ -21,11 +21,19 @@ function composeURL() {
export default ({
withWsAdapter = false
} = {}) => {
let client = createClient({
let clientOpts = {
url: composeURL(),
password: process.env.REDIS_PASSWORD,
username: process.env.REDIS_USERNAME,
})
}
if (process.env.REDIS_PASSWORD) {
clientOpts.password = process.env.REDIS_PASSWORD
}
if (process.env.REDIS_USERNAME) {
clientOpts.username = process.env.REDIS_USERNAME
}
let client = createClient()
if (withWsAdapter) {
client.subClient = client.duplicate()