From e48852e0e2de4441b5ef84dc9bb16be8ba9c01d8 Mon Sep 17 00:00:00 2001 From: WilliButz Date: Wed, 5 Sep 2018 19:50:46 +0200 Subject: [PATCH] lib/config: add environment variable to set config file Previously it was assumed that `config.json` would be placed in the same directory as the rest of CodiMD without any optional override. This allows to override the path to the `config.json` by setting `CMD_CONFIG_FILE` to the canonical path of the desired config file. Signed-off-by: WilliButz --- lib/config/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/config/index.js b/lib/config/index.js index 26f0ae965..76c8bbf1f 100644 --- a/lib/config/index.js +++ b/lib/config/index.js @@ -23,7 +23,8 @@ const packageConfig = { minimumCompatibleVersion: '0.5.0' } -const configFilePath = path.join(appRootPath, 'config.json') +const configFilePath = path.resolve(appRootPath, process.env.CMD_CONFIG_FILE || +'config.json') const fileConfig = fs.existsSync(configFilePath) ? require(configFilePath)[env] : undefined let config = require('./default')