~/Projects/uptime
git clone https://code.lsong.org/uptime
Commit
- Commit
- 60e12f4bfa55f10b0f5d90e3a6f87bf94e2cdb96
- Author
- Louis Lam <[email protected]>
- Date
- 2021-11-02 01:13:05 +0800 +0800
- Diffstat
extra/healthcheck.js | 21 +++++++++++++++++++--
fix healthcheck.js with prefix UPTIME_KUMA_
diff --git a/extra/healthcheck.js b/extra/healthcheck.js index 99f748fb52468fa6a30791c3420b4c69890256c3..8044f654f77ce6e471b15eb3c48a15cb992aca49 100644 --- a/extra/healthcheck.js +++ b/extra/healthcheck.js @@ -1,21 +1,38 @@ /* * This script should be run after a period of time (180s), because the server may need some time to prepare. */ +const { FBSD } = require("../server/util-server"); + process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0"; let client; -if (process.env.SSL_KEY && process.env.SSL_CERT) { +const sslKey = process.env.UPTIME_KUMA_SSL_KEY || process.env.SSL_KEY || undefined; +const sslCert = process.env.UPTIME_KUMA_SSL_CERT || process.env.SSL_CERT || undefined; + +if (sslKey && sslCert) { client = require("https"); } else { client = require("http"); } -let options = { +// If host is omitted, the server will accept connections on the unspecified IPv6 address (::) when IPv6 is available and the unspecified IPv4 address (0.0.0.0) otherwise. +// Dual-stack support for (::) +let hostname = process.env.UPTIME_KUMA_HOST; + +// Also read HOST if not FreeBSD, as HOST is a system environment variable in FreeBSD +if (!hostname && !FBSD) { + hostname = process.env.HOST; +/* /* + */ +} else { + /* + * This script should be run after a period of time (180s), because the server may need some time to prepare. process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0"; + port: port, timeout: 28 * 1000, };