From f92327b57ff5bf3d94de07fe3b0d11f341afd092 Mon Sep 17 00:00:00 2001 From: Nauras Jabari Date: Fri, 21 Jul 2023 09:58:41 -0400 Subject: [PATCH] feat: mongo connection now supports username/password as well as x509 cert authentication --- packages/be/config.js | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/packages/be/config.js b/packages/be/config.js index 46b68a6..8cbb2de 100644 --- a/packages/be/config.js +++ b/packages/be/config.js @@ -55,14 +55,20 @@ module.exports = { ], serveStaticDirectories: [], // ================================================================== Database - databaseUrl: process.env.DATABASE_URL, + databaseUrl: process.env.DATABASE_URL, // for x509 auth, use process.env.DATABASE_URL_X509 mongoConnectionOptions: { - ssl: true, - sslValidate: true, - sslCA: Path.resolve(process.env.DPP_CA_PATH), - sslKey: Path.resolve(process.env.MONGODB_CLIENT_PEM), - sslCert: Path.resolve(process.env.MONGODB_CLIENT_PEM), - authMechanism: 'MONGODB-X509' + // Authenticate with username/password + auth: { + username: process.env.DATABASE_USER, + password: process.env.DATABASE_PASSWORD + } + // Authenticate using x509 certificates + // ssl: true, + // sslValidate: true, + // sslCA: Path.resolve(process.env.DPP_CA_PATH), + // sslKey: Path.resolve(process.env.MONGODB_CLIENT_PEM), + // sslCert: Path.resolve(process.env.MONGODB_CLIENT_PEM), + // authMechanism: 'MONGODB-X509' }, mongooseConnection: false, model: {},