Remove duplication
This commit is contained in:
parent
ad71fc9481
commit
cfc69e69e8
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue