summaryrefslogtreecommitdiff
path: root/lib/config
diff options
context:
space:
mode:
authorWilliButz2018-09-05 19:50:46 +0200
committerWilliButz2018-09-26 16:56:37 +0200
commite48852e0e2de4441b5ef84dc9bb16be8ba9c01d8 (patch)
tree709f071a1912a3c56777de316c916f804e69cb98 /lib/config
parentbd2f7cef495b87050ec3f126e7425095078440b2 (diff)
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 <wbutz@cyberfnord.de>
Diffstat (limited to 'lib/config')
-rw-r--r--lib/config/index.js3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/config/index.js b/lib/config/index.js
index 26f0ae96..76c8bbf1 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')