From b106d90b64a6e6f0cc480112ddd7556b3fac8bf6 Mon Sep 17 00:00:00 2001 From: schlagmichdoch Date: Tue, 23 May 2023 02:43:17 +0200 Subject: [PATCH] Fix ReferenceError: ipv6_lcl is not defined --- index.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index f9a9a34..e7e47f1 100644 --- a/index.js +++ b/index.js @@ -96,14 +96,15 @@ if (debugMode) { console.log("DEBUG_MODE is active. To protect privacy, do not use in production.") } +let ipv6_lcl; if (process.env.IPV6_LOCALIZE) { - let ipv6_lcl = parseInt(process.env.IPV6_LOCALIZE); + ipv6_lcl = parseInt(process.env.IPV6_LOCALIZE); if (!ipv6_lcl || !(0 < ipv6_lcl && ipv6_lcl < 8)) { console.error("IPV6_LOCALIZE must be an integer between 1 and 7"); return; - } else { - console.log("IPv6 client IPs will be localized to", ipv6_lcl, ipv6_lcl > 1 ? "segments" : "segment"); } + + console.log("IPv6 client IPs will be localized to", ipv6_lcl, ipv6_lcl === 1 ? "segment" : "segments"); } app.use(function(req, res) {