1
1
mirror of https://github.com/kokonect-link/cherrypick synced 2024-12-12 21:58:58 +09:00
This commit is contained in:
syuilo 2019-02-07 10:51:55 +09:00
parent 1d2c50fc26
commit 2ef795aba8
No known key found for this signature in database
GPG Key ID: BDC4C49D06AB9D69

View File

@ -8,8 +8,8 @@ const requiredMongoDBVersion = [3, 6];
export function checkMongoDB(config: Config, logger: Logger) {
return new Promise((res, rej) => {
const mongoDBLogger = logger.createSubLogger('db');
const u = config.mongodb.user ? encodeURIComponent(config.mongodb.user) : null;
const p = config.mongodb.pass ? encodeURIComponent(config.mongodb.pass) : null;
const u = config.mongodb.user.map(x => encodeURIComponent(x)).getOrElse(null);
const p = config.mongodb.pass.map(x => encodeURIComponent(x)).getOrElse(null);
const uri = `mongodb://${u && p ? `${u}:****@` : ''}${config.mongodb.host}:${config.mongodb.port}/${config.mongodb.db}`;
mongoDBLogger.info(`Connecting to ${uri} ...`);