mirror of
https://github.com/louislam/uptime-kuma.git
synced 2024-11-27 16:54:04 +00:00
Merge remote-tracking branch 'giacomo892/patch-1'
# Conflicts: # server/ping-lite.js
This commit is contained in:
commit
4bee57ea7f
3 changed files with 22 additions and 10 deletions
|
@ -4,13 +4,9 @@ const net = require("net");
|
||||||
const spawn = require("child_process").spawn;
|
const spawn = require("child_process").spawn;
|
||||||
const events = require("events");
|
const events = require("events");
|
||||||
const fs = require("fs");
|
const fs = require("fs");
|
||||||
|
const { MAC, FBSD, LIN, WIN } = require("./util-server");
|
||||||
const util = require("./util-server");
|
const util = require("./util-server");
|
||||||
|
|
||||||
const WIN = /^win/.test(process.platform);
|
|
||||||
const LIN = /^linux/.test(process.platform);
|
|
||||||
const MAC = /^darwin/.test(process.platform);
|
|
||||||
const FBSD = /^freebsd/.test(process.platform);
|
|
||||||
|
|
||||||
module.exports = Ping;
|
module.exports = Ping;
|
||||||
|
|
||||||
function Ping(host, options) {
|
function Ping(host, options) {
|
||||||
|
|
|
@ -43,7 +43,7 @@ console.log("Importing this project modules");
|
||||||
debug("Importing Monitor");
|
debug("Importing Monitor");
|
||||||
const Monitor = require("./model/monitor");
|
const Monitor = require("./model/monitor");
|
||||||
debug("Importing Settings");
|
debug("Importing Settings");
|
||||||
const { getSettings, setSettings, setting, initJWTSecret, checkLogin, startUnitTest } = require("./util-server");
|
const { getSettings, setSettings, setting, initJWTSecret, checkLogin, startUnitTest, FBSD } = require("./util-server");
|
||||||
|
|
||||||
debug("Importing Notification");
|
debug("Importing Notification");
|
||||||
const { Notification } = require("./notification");
|
const { Notification } = require("./notification");
|
||||||
|
@ -61,12 +61,22 @@ console.info("Version: " + checkVersion.version);
|
||||||
|
|
||||||
// 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.
|
// 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 (::)
|
// Dual-stack support for (::)
|
||||||
const hostname = process.env.HOST || args.host;
|
let hostname = process.env.UPTIME_KUMA_HOST || args.host;
|
||||||
const port = parseInt(process.env.PORT || args.port || 3001);
|
|
||||||
|
// Also read HOST if not FreeBSD, as HOST is a system environment variable in FreeBSD
|
||||||
|
if (!hostname && !FBSD) {
|
||||||
|
hostname = process.env.HOST;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hostname) {
|
||||||
|
console.log("Custom hostname: " + hostname);
|
||||||
|
}
|
||||||
|
|
||||||
|
const port = parseInt(process.env.UPTIME_KUMA_PORT || process.env.PORT || args.port || 3001);
|
||||||
|
|
||||||
// SSL
|
// SSL
|
||||||
const sslKey = process.env.SSL_KEY || args["ssl-key"] || undefined;
|
const sslKey = process.env.UPTIME_KUMA_SSL_KEY || process.env.SSL_KEY || args["ssl-key"] || undefined;
|
||||||
const sslCert = process.env.SSL_CERT || args["ssl-cert"] || undefined;
|
const sslCert = process.env.UPTIME_KUMA_SSL_CERT || process.env.SSL_CERT || args["ssl-cert"] || undefined;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Run unit test after the server is ready
|
* Run unit test after the server is ready
|
||||||
|
|
|
@ -9,6 +9,12 @@ const child_process = require("child_process");
|
||||||
const iconv = require("iconv-lite");
|
const iconv = require("iconv-lite");
|
||||||
const chardet = require("chardet");
|
const chardet = require("chardet");
|
||||||
|
|
||||||
|
// From ping-lite
|
||||||
|
exports.WIN = /^win/.test(process.platform);
|
||||||
|
exports.LIN = /^linux/.test(process.platform);
|
||||||
|
exports.MAC = /^darwin/.test(process.platform);
|
||||||
|
exports.FBSD = /^freebsd/.test(process.platform);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Init or reset JWT secret
|
* Init or reset JWT secret
|
||||||
* @returns {Promise<Bean>}
|
* @returns {Promise<Bean>}
|
||||||
|
|
Loading…
Reference in a new issue