add validation to port value parsing

only port configurations that are valid (not isNaN) after parseInt
are considered to be used in port variable
pull/1141/head
Marc Harnos 3 years ago
parent 2c8d5d28e9
commit 0053a29d10
No known key found for this signature in database
GPG Key ID: A7D68CEB704F557A

@ -71,7 +71,9 @@ if (hostname) {
console.log("Custom hostname: " + hostname); console.log("Custom hostname: " + hostname);
} }
const port = parseInt(process.env.UPTIME_KUMA_PORT || process.env.PORT || args.port || 3001); const port = [process.env.UPTIME_KUMA_PORT, process.env.PORT, args.port, 3001]
.map(portValue => parseInt(portValue))
.find(portValue => !isNaN(portValue));
// SSL // SSL
const sslKey = process.env.UPTIME_KUMA_SSL_KEY || process.env.SSL_KEY || args["ssl-key"] || undefined; const sslKey = process.env.UPTIME_KUMA_SSL_KEY || process.env.SSL_KEY || args["ssl-key"] || undefined;

Loading…
Cancel
Save