mirror of
https://github.com/Wolvan/poll.horse.git
synced 2024-11-22 13:07:58 +01:00
Fix config loading of boolean values
Setting values from config is a little tricky, but I think this makes it work properly now.
This commit is contained in:
parent
16ca2ee8b1
commit
1507ea6d33
2 changed files with 6 additions and 5 deletions
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -113,3 +113,7 @@ testing/
|
||||||
*.db3
|
*.db3
|
||||||
# Data directory
|
# Data directory
|
||||||
data/
|
data/
|
||||||
|
|
||||||
|
# Config files
|
||||||
|
config*.js*
|
||||||
|
!config.example.json
|
||||||
|
|
|
@ -58,10 +58,7 @@ async function loadConfig(options: CommanderOption[] = [], homedirConfigFilename
|
||||||
.version(version)
|
.version(version)
|
||||||
.option("-c, --config-path <path>", "Path to the configuration file to load", "./config");
|
.option("-c, --config-path <path>", "Path to the configuration file to load", "./config");
|
||||||
options.forEach(([name, description, handler, defaultValue]) => program.option(name, description, handler, defaultValue));
|
options.forEach(([name, description, handler, defaultValue]) => program.option(name, description, handler, defaultValue));
|
||||||
|
Object.keys(config).forEach(option => program.setOptionValueWithSource(option, config[option], "config"));
|
||||||
Object.keys(program.opts()).forEach(option => {
|
|
||||||
if (config[option]) program.opts()[option] = config[option];
|
|
||||||
});
|
|
||||||
|
|
||||||
program.parse(process.argv);
|
program.parse(process.argv);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue