add ability to change the listening port and hostname

pull/22/head 1.0.1
LouisLam 3 years ago
parent c436ef4e05
commit 0176857a2c

8
package-lock.json generated

@ -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",

@ -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",

@ -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();
});

Loading…
Cancel
Save