From 0aebb9caf83057b4d2ebc6d7658f739e1c9ee3ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Tue, 16 Oct 2018 20:27:14 -0400 Subject: [PATCH] closes #6844 --- src/database/mongo.js | 6 +++--- src/database/postgres.js | 4 +++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/database/mongo.js b/src/database/mongo.js index bedd26f0f5..0374bb0967 100644 --- a/src/database/mongo.js +++ b/src/database/mongo.js @@ -77,9 +77,9 @@ mongoModule.getConnectionString = function () { if (!nconf.get('mongo:port')) { nconf.set('mongo:port', 27017); } - console.log(nconf.get('mongo:database'), typeof nconf.get('mongo:database')); - if (!nconf.get('mongo:database')) { - console.log('switching to nodebb database'); + const dbName = nconf.get('mongo:database'); + if (dbName === undefined || dbName === '') { + winston.warn('You have no database name, using "nodebb"'); nconf.set('mongo:database', 'nodebb'); } diff --git a/src/database/postgres.js b/src/database/postgres.js index f06c962c22..463a493ab5 100644 --- a/src/database/postgres.js +++ b/src/database/postgres.js @@ -52,7 +52,9 @@ postgresModule.getConnectionOptions = function () { if (!nconf.get('postgres:port')) { nconf.set('postgres:port', 5432); } - if (!nconf.get('postgres:database')) { + const dbName = nconf.get('postgres:database'); + if (dbName === undefined || dbName === '') { + winston.warn('You have no database name, using "nodebb"'); nconf.set('postgres:database', 'nodebb'); }