Handle boolean values in config.ini properly
parent
0a4d97fc11
commit
7e567a3267
|
@ -273,6 +273,16 @@ for (const numericOpt of numericOptions) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Cast boolean options (on, true, 1) (off, false, 0)
|
||||||
|
for (const [key, value] of Object.entries(finalConfig)) {
|
||||||
|
if (typeof value !== "string") continue;
|
||||||
|
if (["on", "true", "1"].includes(value)) {
|
||||||
|
finalConfig[key] = true;
|
||||||
|
} else if (["off", "false", "0"].includes(value)) {
|
||||||
|
finalConfig[key] = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Make sure all of the required config options are present
|
// Make sure all of the required config options are present
|
||||||
for (const opt of required) {
|
for (const opt of required) {
|
||||||
if (! finalConfig[opt]) {
|
if (! finalConfig[opt]) {
|
||||||
|
|
Loading…
Reference in New Issue