diff --git a/src/app.config.ts b/src/app.config.ts index 93c58b45..3459953d 100644 --- a/src/app.config.ts +++ b/src/app.config.ts @@ -33,8 +33,12 @@ export const MONGO_DB = { dbName: argv.collection_name || (DEMO_MODE ? 'mx-space_demo' : 'mx-space'), host: argv.db_host || '127.0.0.1', port: argv.db_port || 27017, + user: argv.db_user || '', + password: argv.db_password || '', get uri() { - return `mongodb://${this.host}:${this.port}/${ + let userPassword = + this.user && this.password ? this.user + ':' + this.password + '@' : '' + return `mongodb://${userPassword}${this.host}:${this.port}/${ isTest ? 'mx-space_unitest' : this.dbName }` },