Skip to content

Commit

Permalink
add ability to change the listening port and hostname
Browse files Browse the repository at this point in the history
  • Loading branch information
louislam committed Jul 12, 2021
1 parent c436ef4 commit 0176857
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
8 changes: 6 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"name": "uptime-kuma",
"version": "1.0.0",
"scripts": {
"dev": "vite --host",
"start-server": "node server/server.js",
Expand All @@ -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",
Expand Down
11 changes: 9 additions & 2 deletions server/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -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())

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

0 comments on commit 0176857

Please sign in to comment.