diff --git a/.gitignore b/.gitignore index 316a8ed..add605b 100644 --- a/.gitignore +++ b/.gitignore @@ -112,4 +112,8 @@ testing/ *.db *.db3 # Data directory -data/ \ No newline at end of file +data/ + +# Config files +config*.js* +!config.example.json diff --git a/src/config-loader.ts b/src/config-loader.ts index 4896b5e..f250ebe 100644 --- a/src/config-loader.ts +++ b/src/config-loader.ts @@ -58,10 +58,7 @@ async function loadConfig(options: CommanderOption[] = [], homedirConfigFilename .version(version) .option("-c, --config-path ", "Path to the configuration file to load", "./config"); options.forEach(([name, description, handler, defaultValue]) => program.option(name, description, handler, defaultValue)); - - Object.keys(program.opts()).forEach(option => { - if (config[option]) program.opts()[option] = config[option]; - }); + Object.keys(config).forEach(option => program.setOptionValueWithSource(option, config[option], "config")); program.parse(process.argv);