summaryrefslogtreecommitdiff
path: root/lib/config
diff options
context:
space:
mode:
authorSheogorath2018-11-13 23:29:33 +0100
committerSheogorath2018-11-14 00:47:11 +0100
commitc3584770f24205d84b9399abd9535cb27dc7b00c (patch)
treee86baadf379199a78286c49565650abbae2723aa /lib/config
parent54d3d930cf39c2a3bec422d858cbac20ad8118eb (diff)
Upgrade winston
Our log library got a new major version which should be implemented. That's exactly what this patch does. Implementing the new version of the logging library. Signed-off-by: Sheogorath <sheogorath@shivering-isles.com>
Diffstat (limited to 'lib/config')
-rw-r--r--lib/config/default.js1
-rw-r--r--lib/config/environment.js1
-rw-r--r--lib/config/index.js6
3 files changed, 8 insertions, 0 deletions
diff --git a/lib/config/default.js b/lib/config/default.js
index 15f11aaa..71375b98 100644
--- a/lib/config/default.js
+++ b/lib/config/default.js
@@ -7,6 +7,7 @@ module.exports = {
urlPath: '',
host: '0.0.0.0',
port: 3000,
+ loglevel: 'info',
urlAddPort: false,
allowOrigin: ['localhost'],
useSSL: false,
diff --git a/lib/config/environment.js b/lib/config/environment.js
index 0c7c9a4f..4220e54d 100644
--- a/lib/config/environment.js
+++ b/lib/config/environment.js
@@ -9,6 +9,7 @@ module.exports = {
host: process.env.CMD_HOST,
port: toIntegerConfig(process.env.CMD_PORT),
path: process.env.CMD_PATH,
+ loglevel: process.env.CMD_LOGLEVEL,
urlAddPort: toBooleanConfig(process.env.CMD_URL_ADDPORT),
useSSL: toBooleanConfig(process.env.CMD_USESSL),
hsts: {
diff --git a/lib/config/index.js b/lib/config/index.js
index 4e1fa50d..c1005b0b 100644
--- a/lib/config/index.js
+++ b/lib/config/index.js
@@ -45,6 +45,12 @@ merge(config, require('./hackmdEnvironment'))
merge(config, require('./environment'))
merge(config, require('./dockerSecret'))
+if (['debug', 'verbose', 'info', 'warn', 'error'].includes(config.loglevel)) {
+ logger.level = config.loglevel
+} else {
+ logger.error('Selected loglevel %s doesn\'t exist, using default level \'debug\'. Available options: debug, verbose, info, warn, error', config.loglevel)
+}
+
// load LDAP CA
if (config.ldap.tlsca) {
let ca = config.ldap.tlsca.split(',')