feat: support mongo connection with user and password (#806)
This commit is contained in:
@@ -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
|
||||
}`
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user