From d42a2b1670cbf5c88826539d4cda0349a14faf68 Mon Sep 17 00:00:00 2001 From: Anton Pidkaminnyi Date: Tue, 24 May 2022 09:57:45 +0300 Subject: [PATCH] add log level configuration via environment --- README.md | 1 + main/config.js | 6 ++++-- main/server.js | 3 ++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index b51ae14..75e8e76 100644 --- a/README.md +++ b/README.md @@ -28,6 +28,7 @@ Configuration is done through environment variables. - `SECRETS_MANAGER_PORT` the port to run on - **default is 3000** - `SECRETS_MANAGER_PRELOAD_DIRECTORY` absolute path of directory from which to read initial set of secrets (see below) - **default is empty** - `SECRETS_MANAGER_SECRETS` secrets to preload if you are unable to use volume mounts - **default is empty** +- `SECRETS_MANAGER_LOG_LEVEL` override log level - **default is 'info'** ## Preloading secrets diff --git a/main/config.js b/main/config.js index 6ce239d..6867070 100644 --- a/main/config.js +++ b/main/config.js @@ -6,11 +6,13 @@ nconf .defaults({ NODE_ENV: 'dev', SECRETS_MANAGER_PRELOAD_DIRECTORY: '', - SECRETS_MANAGER_PORT: 3000 + SECRETS_MANAGER_PORT: 3000, + SECRETS_MANAGER_LOG_LEVEL: 'info' }); module.exports = { NODE_ENV: nconf.get('NODE_ENV'), PRELOAD_DIRECTORY: nconf.get('SECRETS_MANAGER_PRELOAD_DIRECTORY'), - PORT: nconf.get('SECRETS_MANAGER_PORT') + PORT: nconf.get('SECRETS_MANAGER_PORT'), + LOG_LEVEL: nconf.get('SECRETS_MANAGER_LOG_LEVEL') }; diff --git a/main/server.js b/main/server.js index 31f9ee5..beb8531 100644 --- a/main/server.js +++ b/main/server.js @@ -29,7 +29,8 @@ async function go(config) { options: { colorize: true } - } + }, + level: config.LOG_LEVEL } });