forked from Galactic/galactic-bot
fix
This commit is contained in:
parent
d4ab0ff66d
commit
0cdef2db8b
@ -11,10 +11,10 @@ class MongoDBProvider extends Provider {
|
||||
});
|
||||
|
||||
const { MONGODB_HOST, MONGODB_USERNAME, MONGODB_PASSWORD, MONGODB_DATABASE } = process.env;
|
||||
const database = MONGODB_DATABASE;
|
||||
this.database = MONGODB_DATABASE;
|
||||
// const { database } = this.config;
|
||||
const auth = MONGODB_USERNAME ? `${MONGODB_USERNAME}:${MONGODB_PASSWORD}@`:'';
|
||||
this.URI = `mongodb://${auth}${MONGODB_HOST}/${database}?authSource=${database}`;
|
||||
this.URI = `mongodb://${auth}${MONGODB_HOST}/${this.database}?authSource=${this.database}`;
|
||||
|
||||
}
|
||||
|
||||
@ -22,7 +22,7 @@ class MongoDBProvider extends Provider {
|
||||
|
||||
try {
|
||||
this.connection = await MongoClient.connect(this.URI, { useNewUrlParser: true });
|
||||
this.db = await this.connection.db(this.config.database);
|
||||
this.db = await this.connection.db(this.database);
|
||||
return this._initialized = true; //eslint-disable-line no-return-assign
|
||||
} catch (err) {
|
||||
this._error(err);
|
||||
|
Loading…
Reference in New Issue
Block a user