Remove duplication

This commit is contained in:
Malachi Soord 2023-11-11 11:35:14 +01:00
parent ad71fc9481
commit cfc69e69e8
No known key found for this signature in database
GPG Key ID: C61BEBD6CC542333
1 changed files with 4 additions and 3 deletions

View File

@ -124,17 +124,18 @@ if (ipsToAllow !== undefined) {
process.exit(1); process.exit(1);
} }
const splitIps = ipsToAllow.split(",");
const net = require("net"); const net = require("net");
for (const ip of ipsToAllow.split(",")) { for (const ip of splitIps) {
if (net.isIP(ip) === 0) { if (net.isIP(ip) === 0) {
log.error("server", "Provided IPs to allow must be valid IP addresses, " + ip + " provided"); log.error("server", "Provided IPs to allow must be valid IP addresses, " + ip + " provided");
process.exit(1); process.exit(1);
} }
} }
log.info("server", "IPs to allow: " + ipsToAllow); log.info("server", "IPs to allow: " + splitIps);
const ipfilter = require("express-ipfilter").IpFilter; const ipfilter = require("express-ipfilter").IpFilter;
app.use(ipfilter(ipsToAllow.split(","), { mode: "allow" })); app.use(ipfilter(splitIps, { mode: "allow" }));
} }
// 2FA / notp verification defaults // 2FA / notp verification defaults