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

View file

@ -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