Fix setting protocols with env

This commit is contained in:
Cohee
2025-02-20 22:28:30 +02:00
parent eb31d7baa2
commit 2b28065c9f
2 changed files with 6 additions and 6 deletions

View File

@@ -285,10 +285,10 @@ const enableAccounts = getConfigValue('enableUserAccounts', DEFAULT_ACCOUNTS, 'b
const uploadsPath = path.join(globalThis.DATA_ROOT, UPLOADS_DIRECTORY); const uploadsPath = path.join(globalThis.DATA_ROOT, UPLOADS_DIRECTORY);
/** @type {boolean | "auto"} */ /** @type {boolean | string} */
let enableIPv6 = stringToBool(cliArguments.enableIPv6) ?? getConfigValue('protocol.ipv6', DEFAULT_ENABLE_IPV6); let enableIPv6 = stringToBool(cliArguments.enableIPv6) ?? stringToBool(getConfigValue('protocol.ipv6', DEFAULT_ENABLE_IPV6)) ?? DEFAULT_ENABLE_IPV6;
/** @type {boolean | "auto"} */ /** @type {boolean | string} */
let enableIPv4 = stringToBool(cliArguments.enableIPv4) ?? getConfigValue('protocol.ipv4', DEFAULT_ENABLE_IPV4); let enableIPv4 = stringToBool(cliArguments.enableIPv4) ?? stringToBool(getConfigValue('protocol.ipv4', DEFAULT_ENABLE_IPV4)) ?? DEFAULT_ENABLE_IPV4;
/** @type {string} */ /** @type {string} */
const autorunHostname = cliArguments.autorunHostname ?? getConfigValue('autorunHostname', DEFAULT_AUTORUN_HOSTNAME); const autorunHostname = cliArguments.autorunHostname ?? getConfigValue('autorunHostname', DEFAULT_AUTORUN_HOSTNAME);

View File

@@ -787,8 +787,8 @@ export function toBoolean(value) {
* @returns {boolean|string|null} boolean else original input string or null if input is * @returns {boolean|string|null} boolean else original input string or null if input is
*/ */
export function stringToBool(str) { export function stringToBool(str) {
if (str === 'true') return true; if (String(str).trim().toLowerCase() === 'true') return true;
if (str === 'false') return false; if (String(str).trim().toLowerCase() === 'false') return false;
return str; return str;
} }