mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-09 18:44:16 +00:00
use param auth
This commit is contained in:
parent
1782565692
commit
9fcabfc2ad
@ -8,22 +8,16 @@ function getConnectionConfig(obj) {
|
|||||||
"://",
|
"://",
|
||||||
]
|
]
|
||||||
|
|
||||||
if (DB_USER && DB_PWD) {
|
|
||||||
auth.push(`${DB_USER}:${DB_PWD}@`)
|
|
||||||
}
|
|
||||||
|
|
||||||
auth.push(DB_HOSTNAME ?? "localhost")
|
auth.push(DB_HOSTNAME ?? "localhost")
|
||||||
auth.push(`:${DB_PORT ?? "27017"}`)
|
auth.push(`:${DB_PORT ?? "27017"}`)
|
||||||
|
|
||||||
if (DB_USER) {
|
|
||||||
auth.push("/?authMechanism=DEFAULT")
|
|
||||||
}
|
|
||||||
|
|
||||||
auth = auth.join("")
|
auth = auth.join("")
|
||||||
|
|
||||||
const params = {
|
const params = {
|
||||||
auth: {},
|
auth: {},
|
||||||
dbName: DB_NAME,
|
dbName: DB_NAME,
|
||||||
|
user: DB_USER,
|
||||||
|
pass: DB_PWD,
|
||||||
useNewUrlParser: true,
|
useNewUrlParser: true,
|
||||||
useUnifiedTopology: true,
|
useUnifiedTopology: true,
|
||||||
}
|
}
|
||||||
@ -49,11 +43,7 @@ export default class DBManager {
|
|||||||
const connection = await mongoose.connect(...dbConfig)
|
const connection = await mongoose.connect(...dbConfig)
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
console.log(`❌ Failed to connect to DB, retrying...\n`)
|
console.log(`❌ Failed to connect to DB, retrying...\n`)
|
||||||
console.log(error)
|
console.log(err)
|
||||||
|
|
||||||
// setTimeout(() => {
|
|
||||||
// this.initialize()
|
|
||||||
// }, 1000)
|
|
||||||
|
|
||||||
return false
|
return false
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user