From 2ef795aba8a0dccf791000653ceea03a2ded7b26 Mon Sep 17 00:00:00 2001 From: syuilo Date: Thu, 7 Feb 2019 10:51:55 +0900 Subject: [PATCH] Fix bug --- src/misc/check-mongodb.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/misc/check-mongodb.ts b/src/misc/check-mongodb.ts index f3839da31..01f7d09d8 100644 --- a/src/misc/check-mongodb.ts +++ b/src/misc/check-mongodb.ts @@ -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} ...`);