From 9fcabfc2ad92bfac2ef5e0e285a39830f1512c87 Mon Sep 17 00:00:00 2001 From: SrGooglo Date: Sat, 10 Jun 2023 23:08:03 +0000 Subject: [PATCH] use param auth --- shared/classes/DbManager/index.js | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/shared/classes/DbManager/index.js b/shared/classes/DbManager/index.js index 7c85ca66..81475000 100755 --- a/shared/classes/DbManager/index.js +++ b/shared/classes/DbManager/index.js @@ -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_PORT ?? "27017"}`) - if (DB_USER) { - auth.push("/?authMechanism=DEFAULT") - } - auth = auth.join("") const params = { auth: {}, dbName: DB_NAME, + user: DB_USER, + pass: DB_PWD, useNewUrlParser: true, useUnifiedTopology: true, } @@ -49,11 +43,7 @@ export default class DBManager { const connection = await mongoose.connect(...dbConfig) .catch((err) => { console.log(`❌ Failed to connect to DB, retrying...\n`) - console.log(error) - - // setTimeout(() => { - // this.initialize() - // }, 1000) + console.log(err) return false })