From 5785faad406a6221f385fc878f934597272dfc5e Mon Sep 17 00:00:00 2001 From: Hri7566 Date: Sat, 28 May 2022 22:38:56 -0400 Subject: [PATCH] add submodule --- .gitmodules | 3 +++ http-server.js | 0 mpp.hri7566.info | 1 + src/Database.js | 6 ++++-- src/Logger.js | 8 ++++---- 5 files changed, 12 insertions(+), 6 deletions(-) create mode 100644 .gitmodules create mode 100644 http-server.js create mode 160000 mpp.hri7566.info diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..6ad8a50 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "mpp.hri7566.info"] + path = mpp.hri7566.info + url = git@gitlab.com:Hri7566/mpp.hri7566.info.git diff --git a/http-server.js b/http-server.js new file mode 100644 index 0000000..e69de29 diff --git a/mpp.hri7566.info b/mpp.hri7566.info new file mode 160000 index 0000000..91ff834 --- /dev/null +++ b/mpp.hri7566.info @@ -0,0 +1 @@ +Subproject commit 91ff8343d35176eb8bcfb4c51396871a7ddac5b6 diff --git a/src/Database.js b/src/Database.js index 247aad6..762dbad 100644 --- a/src/Database.js +++ b/src/Database.js @@ -12,11 +12,13 @@ var logger = new Logger("Database"); mongoose.connect(process.env.MONGO_URL, { useNewUrlParser: true, - useUnifiedTopology: true + useUnifiedTopology: true, + connectTimeoutMS: 1000 }, err => { if (err) { console.error(err); - return; + logger.error("Unable to connect to database service"); + process.exit(1); } logger.log("Connected"); }); diff --git a/src/Logger.js b/src/Logger.js index 2f1411e..8ca6cdb 100644 --- a/src/Logger.js +++ b/src/Logger.js @@ -6,20 +6,20 @@ class Logger { } log(args) { - console.log(chalk.green(`[${this.context}]`), args); + console.log(chalk.blue(`[INFO] [${this.context}]`), args); } warn(args) { - console.warn(chalk.yellow(`[WARN] [${this.context}]`), args); + console.warn(chalk.yellow(`[WARNING] [${this.context}]`), args); } error(args) { - console.error(chalk.red(`[ERR] [${this.context}]`), args); + console.error(chalk.red(`[ERROR] [${this.context}]`), args); } debug(args) { if (process.env.DEBUG_ENABLED) { - console.log(chalk.blue(`[DEBUG] [${this.context}]`), args); + console.log(chalk.green(`[DEBUG] [${this.context}]`), args); } } }