compose db conn params

This commit is contained in:
SrGooglo 2023-06-10 22:54:11 +00:00
parent 7ca70d013d
commit 1782565692

View File

@ -19,19 +19,22 @@ function getConnectionConfig(obj) {
auth.push("/?authMechanism=DEFAULT") auth.push("/?authMechanism=DEFAULT")
} }
if (DB_AUTH_SOURCE && DB_USER) { auth = auth.join("")
auth.push(`&authSource=${DB_AUTH_SOURCE}`)
const params = {
auth: {},
dbName: DB_NAME,
useNewUrlParser: true,
useUnifiedTopology: true,
} }
auth = auth.join("") if (DB_AUTH_SOURCE) {
params.auth.authSource = DB_AUTH_SOURCE
}
return [ return [
auth, auth,
{ params,
dbName: DB_NAME,
useNewUrlParser: true,
useUnifiedTopology: true,
}
] ]
} }