From cfc69e69e8593f0b70175507f8e05ffec9b8c3b3 Mon Sep 17 00:00:00 2001 From: Malachi Soord Date: Sat, 11 Nov 2023 11:35:14 +0100 Subject: [PATCH] Remove duplication --- server/server.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/server/server.js b/server/server.js index c9cc92f2c..e7e785e81 100644 --- a/server/server.js +++ b/server/server.js @@ -124,17 +124,18 @@ if (ipsToAllow !== undefined) { process.exit(1); } + const splitIps = ipsToAllow.split(","); const net = require("net"); - for (const ip of ipsToAllow.split(",")) { + for (const ip of splitIps) { if (net.isIP(ip) === 0) { log.error("server", "Provided IPs to allow must be valid IP addresses, " + ip + " provided"); process.exit(1); } } - log.info("server", "IPs to allow: " + ipsToAllow); + log.info("server", "IPs to allow: " + splitIps); const ipfilter = require("express-ipfilter").IpFilter; - app.use(ipfilter(ipsToAllow.split(","), { mode: "allow" })); + app.use(ipfilter(splitIps, { mode: "allow" })); } // 2FA / notp verification defaults