From 4ee6d0b5497ffcb2fda91e7f45091eac24e37943 Mon Sep 17 00:00:00 2001 From: Aya Morisawa Date: Sun, 12 Aug 2018 00:01:07 +0900 Subject: [PATCH] Refactoring (#2160) --- src/db/mongodb.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/db/mongodb.ts b/src/db/mongodb.ts index 034473b0d..f82ced176 100644 --- a/src/db/mongodb.ts +++ b/src/db/mongodb.ts @@ -3,9 +3,7 @@ import config from '../config'; const u = config.mongodb.user ? encodeURIComponent(config.mongodb.user) : null; const p = config.mongodb.pass ? encodeURIComponent(config.mongodb.pass) : null; -const uri = u && p - ? `mongodb://${u}:${p}@${config.mongodb.host}:${config.mongodb.port}/${config.mongodb.db}` - : `mongodb://${config.mongodb.host}:${config.mongodb.port}/${config.mongodb.db}`; +const uri = `mongodb://${u && p ? `${u}:${p}@` : ''}${config.mongodb.host}:${config.mongodb.port}/${config.mongodb.db}`; /** * monk