Skip to content

Commit

Permalink
Add MONGO_DB_CONNECTION_STRING to override the connection string bu…
Browse files Browse the repository at this point in the history
…ilder

This avoids the need of having to specify the following environment variables:
`MONGO_DB_HOST`, `MONGO_DB_PORT`, `MONGO_DB_USER`, `MONGO_DB_PASSWORD` and `MONGO_DB_AUTHSOURCE` and allows greater control of the connection string.
  • Loading branch information
rudivanhierden committed Aug 24, 2022
1 parent c21398a commit 12b32db
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions app-init.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ const sessionStore = new MySQLStore({


function getMongoDbConnectionString () {
// Allow the connection string builder to be overridden by an environment variable
if (process.env.MONGO_DB_CONNECTION_STRING) {
return process.env.MONGO_DB_CONNECTION_STRING;
}

const host = process.env.MONGO_DB_HOST || 'localhost';
const port = process.env.MONGO_DB_PORT || 27017;
const user = process.env.MONGO_DB_USER || '';
Expand Down

0 comments on commit 12b32db

Please sign in to comment.