Skip to content

Commit

Permalink
Added support for bind IP in the CLI params.
Browse files Browse the repository at this point in the history
In addition to the first command line argument supporting a custom bind port (from the default 8888),
added support for a custom bind IP as the second command line argument.

Useful when the user may want to run the server on a particular network interface and not all (which is the default behaviour).

The code change keeps the default behaviour as is.

Signed-off-by: Md Safiyat Reza <safiyat@voereir.com>
  • Loading branch information
safiyat committed Oct 11, 2023
1 parent 109903f commit 6e43ed5
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions node-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ var http = require("http"),
path = require("path"),
fs = require("fs");
port = process.argv[2] || 8888;
bindIP = process.argv[3] || "0.0.0.0";

http
.createServer(function(request, response) {
Expand Down Expand Up @@ -49,6 +50,6 @@ http
});
});
})
.listen(parseInt(port, 10));
.listen(parseInt(port, 10), bindIP);

console.log("WebUI Aria2 Server is running on http://localhost:" + port);
console.log("WebUI Aria2 Server is running on http://" + bindIP + ":" + port);

0 comments on commit 6e43ed5

Please sign in to comment.