mirror of
https://github.com/Wolvan/poll.horse.git
synced 2024-11-21 20:47:59 +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
6
.gitignore
vendored
6
.gitignore
vendored
|
@ -112,4 +112,8 @@ testing/
|
|||
*.db
|
||||
*.db3
|
||||
# Data directory
|
||||
data/
|
||||
data/
|
||||
|
||||
# Config files
|
||||
config*.js*
|
||||
!config.example.json
|
||||
|
|
|
@ -58,10 +58,7 @@ async function loadConfig(options: CommanderOption[] = [], homedirConfigFilename
|
|||
.version(version)
|
||||
.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));
|
||||
|
||||
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);
|
||||
|
||||
|
|
Loading…
Reference in a new issue