From 7e567a32676cb4755c713f7e3b46f63c781c29fe Mon Sep 17 00:00:00 2001 From: Dragory <2606411+Dragory@users.noreply.github.com> Date: Tue, 3 Dec 2019 03:00:26 +0200 Subject: [PATCH] Handle boolean values in config.ini properly --- src/config.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/config.js b/src/config.js index fceaa15..a9546e5 100644 --- a/src/config.js +++ b/src/config.js @@ -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 for (const opt of required) { if (! finalConfig[opt]) {