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.push(`&authSource=${DB_AUTH_SOURCE}`)
}
auth = auth.join("") auth = auth.join("")
return [ const params = {
auth, auth: {},
{
dbName: DB_NAME, dbName: DB_NAME,
useNewUrlParser: true, useNewUrlParser: true,
useUnifiedTopology: true, useUnifiedTopology: true,
} }
if (DB_AUTH_SOURCE) {
params.auth.authSource = DB_AUTH_SOURCE
}
return [
auth,
params,
] ]
} }