Enhance log message
This commit is contained in:
parent
4bdef3720c
commit
ab3f8fd10c
|
@ -154,11 +154,10 @@ async function init(): Promise<Config> {
|
|||
|
||||
function checkMongoDb(config: Config) {
|
||||
const mongoDBLogger = new Logger('MongoDB');
|
||||
mongoDBLogger.info(`Host: ${config.mongodb.host}`);
|
||||
mongoDBLogger.info(`Port: ${config.mongodb.port}`);
|
||||
mongoDBLogger.info(`DB: ${config.mongodb.db}`);
|
||||
if (config.mongodb.user) mongoDBLogger.info(`User: ${config.mongodb.user}`);
|
||||
if (config.mongodb.pass) mongoDBLogger.info(`Pass: ****`);
|
||||
const u = config.mongodb.user ? encodeURIComponent(config.mongodb.user) : null;
|
||||
const p = config.mongodb.pass ? encodeURIComponent(config.mongodb.pass) : null;
|
||||
const uri = `mongodb://${u && p ? `${u}:****@` : ''}${config.mongodb.host}:${config.mongodb.port}/${config.mongodb.db}`;
|
||||
mongoDBLogger.info(`Connecting to ${uri}`);
|
||||
require('./db/mongodb');
|
||||
mongoDBLogger.succ('Connectivity confirmed');
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue