Skip to content

Commit e48852e

Browse files
committed
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 <[email protected]>
1 parent bd2f7ce commit e48852e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/config/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ const packageConfig = {
2323
minimumCompatibleVersion: '0.5.0'
2424
}
2525

26-
const configFilePath = path.join(appRootPath, 'config.json')
26+
const configFilePath = path.resolve(appRootPath, process.env.CMD_CONFIG_FILE ||
27+
'config.json')
2728
const fileConfig = fs.existsSync(configFilePath) ? require(configFilePath)[env] : undefined
2829

2930
let config = require('./default')

0 commit comments

Comments
 (0)