Skip to content

Commit

Permalink
feat: mongo connection now supports username/password as well as x509…
Browse files Browse the repository at this point in the history
… cert authentication
  • Loading branch information
timelytree committed Jul 21, 2023
1 parent 924bfe4 commit f92327b
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions packages/be/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: {},
Expand Down

0 comments on commit f92327b

Please sign in to comment.