add ability to change the listening port and hostname
This commit is contained in:
parent
c436ef4e05
commit
0176857a2c
|
@ -1,8 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "uptime-kuma",
|
"name": "uptime-kuma",
|
||||||
"version": "1.0.0",
|
|
||||||
"lockfileVersion": 1,
|
|
||||||
"requires": true,
|
"requires": true,
|
||||||
|
"lockfileVersion": 1,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/helper-validator-identifier": {
|
"@babel/helper-validator-identifier": {
|
||||||
"version": "7.14.5",
|
"version": "7.14.5",
|
||||||
|
@ -243,6 +242,11 @@
|
||||||
"readable-stream": "^2.0.6"
|
"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": {
|
"arr-diff": {
|
||||||
"version": "4.0.0",
|
"version": "4.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-4.0.0.tgz",
|
"resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-4.0.0.tgz",
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
{
|
{
|
||||||
"name": "uptime-kuma",
|
"name": "uptime-kuma",
|
||||||
"version": "1.0.0",
|
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite --host",
|
"dev": "vite --host",
|
||||||
"start-server": "node server/server.js",
|
"start-server": "node server/server.js",
|
||||||
|
@ -12,6 +11,7 @@
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@popperjs/core": "^2.9.2",
|
"@popperjs/core": "^2.9.2",
|
||||||
|
"args-parser": "^1.3.0",
|
||||||
"axios": "^0.21.1",
|
"axios": "^0.21.1",
|
||||||
"bootstrap": "^5.0.0",
|
"bootstrap": "^5.0.0",
|
||||||
"dayjs": "^1.10.4",
|
"dayjs": "^1.10.4",
|
||||||
|
|
|
@ -12,6 +12,13 @@ const Monitor = require("./model/monitor");
|
||||||
const fs = require("fs");
|
const fs = require("fs");
|
||||||
const {getSettings} = require("./util-server");
|
const {getSettings} = require("./util-server");
|
||||||
const {Notification} = require("./notification")
|
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())
|
app.use(express.json())
|
||||||
|
|
||||||
|
@ -435,8 +442,8 @@ let needSetup = false;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
server.listen(3001, () => {
|
server.listen(port, hostname, () => {
|
||||||
console.log('Listening on 3001');
|
console.log(`Listening on ${hostname}:${port}`);
|
||||||
|
|
||||||
startMonitors();
|
startMonitors();
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue