diff --git a/config.json b/config.json index 26ca3b92..0719e85c 100644 --- a/config.json +++ b/config.json @@ -1,5 +1,6 @@ { "debug": false, + "host": "0.0.0.0", "port": 9000, "theme": "themes/example.css", "public": true diff --git a/src/command-line/start.js b/src/command-line/start.js index 0927d224..83393bb0 100644 --- a/src/command-line/start.js +++ b/src/command-line/start.js @@ -4,6 +4,7 @@ var program = require("commander"); var shout = require("../server"); program + .option("-h, --host ") .option("-p, --port ") .command("start") .description("Start the server") @@ -15,7 +16,8 @@ program console.log("Create a new user with 'shout add '.") console.log(""); } else { + var host = program.host || config.host; var port = program.port || config.port; - shout(port, config.public); + shout(port, host, config.public); } }); diff --git a/src/server.js b/src/server.js index 0275ba6a..beb60de6 100644 --- a/src/server.js +++ b/src/server.js @@ -26,15 +26,16 @@ var inputs = [ "whois" ]; -module.exports = function(port, isPublic) { +module.exports = function(port, host, isPublic) { config.port = port; + config.host = host; config.public = isPublic; var app = http() .use(index) .use(http.static("client")) .use(http.static(process.env.HOME + "/.shout/cache")) - .listen(config.port); + .listen(config.port, config.host); sockets = io(app); sockets.on("connect", function(socket) { @@ -46,7 +47,7 @@ module.exports = function(port, isPublic) { }); console.log(""); - console.log("Shout is now running on port " + config.port); + console.log("Shout is now running on host/port " + config.host + ":" + config.port); console.log("Press ctrl-c to stop"); console.log("");