From 1609d379e2fb1e4f14a8505770afeb4b99be921c Mon Sep 17 00:00:00 2001 From: Marc Harnos Date: Fri, 7 Jan 2022 23:13:38 +0100 Subject: [PATCH] simplify host fallback logic and fix order - move decision logic for freeBSD HOST environment var into temp var - change prioritization from most specific config to least specific, meaning that args.host takes precedent over env.HOST, which takes precendent over env.UPTIME_KUMA_HOST with no fallback value --- server/server.js | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/server/server.js b/server/server.js index 868bbd5efa4..63db98a9cc0 100644 --- a/server/server.js +++ b/server/server.js @@ -63,12 +63,9 @@ console.info("Version: " + checkVersion.version); // If host is omitted, the server will accept connections on the unspecified IPv6 address (::) when IPv6 is available and the unspecified IPv4 address (0.0.0.0) otherwise. // Dual-stack support for (::) -let hostname = process.env.UPTIME_KUMA_HOST || args.host; - // Also read HOST if not FreeBSD, as HOST is a system environment variable in FreeBSD -if (!hostname && !FBSD) { - hostname = process.env.HOST; -} +let hostEnv = FBSD ? null : process.env.HOST; +let hostname = args.host || hostEnv || process.env.UPTIME_KUMA_HOST; if (hostname) { console.log("Custom hostname: " + hostname);