compose db conn params

This commit is contained in:
SrGooglo 2023-06-10 22:54:11 +00:00
parent 12d100b3de
commit ca426e77e3

View File

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