mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-12 20:14:15 +00:00
improve redis auth
This commit is contained in:
parent
0a17e141a9
commit
be4e2a3cd9
@ -21,11 +21,19 @@ function composeURL() {
|
|||||||
export default ({
|
export default ({
|
||||||
withWsAdapter = false
|
withWsAdapter = false
|
||||||
} = {}) => {
|
} = {}) => {
|
||||||
let client = createClient({
|
let clientOpts = {
|
||||||
url: composeURL(),
|
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) {
|
if (withWsAdapter) {
|
||||||
client.subClient = client.duplicate()
|
client.subClient = client.duplicate()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user