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>
This commit is contained in:
parent
bd2f7cef49
commit
e48852e0e2
1 changed files with 2 additions and 1 deletions
|
@ -23,7 +23,8 @@ const packageConfig = {
|
||||||
minimumCompatibleVersion: '0.5.0'
|
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
|
const fileConfig = fs.existsSync(configFilePath) ? require(configFilePath)[env] : undefined
|
||||||
|
|
||||||
let config = require('./default')
|
let config = require('./default')
|
||||||
|
|
Loading…
Reference in a new issue