1
0
mirror of https://github.com/louislam/uptime-kuma.git synced 2024-11-28 08:48:45 +02:00

add ability to change the listening port and hostname

This commit is contained in:
LouisLam 2021-07-12 18:33:25 +08:00
parent c436ef4e05
commit 0176857a2c
3 changed files with 16 additions and 5 deletions

8
package-lock.json generated
View File

@ -1,8 +1,7 @@
{
"name": "uptime-kuma",
"version": "1.0.0",
"lockfileVersion": 1,
"requires": true,
"lockfileVersion": 1,
"dependencies": {
"@babel/helper-validator-identifier": {
"version": "7.14.5",
@ -243,6 +242,11 @@
"readable-stream": "^2.0.6"
}
},
"args-parser": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/args-parser/-/args-parser-1.3.0.tgz",
"integrity": "sha512-If3Zi4BSjlQIJ9fgAhSiKi0oJtgMzSqh0H4wvl7XSeO16FKx7QqaHld8lZeEajPX7y1C5qKKeNgyrfyvmjmjUQ=="
},
"arr-diff": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-4.0.0.tgz",

View File

@ -1,6 +1,5 @@
{
"name": "uptime-kuma",
"version": "1.0.0",
"scripts": {
"dev": "vite --host",
"start-server": "node server/server.js",
@ -12,6 +11,7 @@
},
"dependencies": {
"@popperjs/core": "^2.9.2",
"args-parser": "^1.3.0",
"axios": "^0.21.1",
"bootstrap": "^5.0.0",
"dayjs": "^1.10.4",

View File

@ -12,6 +12,13 @@ const Monitor = require("./model/monitor");
const fs = require("fs");
const {getSettings} = require("./util-server");
const {Notification} = require("./notification")
const args = require('args-parser')(process.argv);
console.log("args:")
console.log(args)
const hostname = args.host || "0.0.0.0"
const port = args.port || 3001
app.use(express.json())
@ -435,8 +442,8 @@ let needSetup = false;
});
});
server.listen(3001, () => {
console.log('Listening on 3001');
server.listen(port, hostname, () => {
console.log(`Listening on ${hostname}:${port}`);
startMonitors();
});