Merge pull request #68 from JonathanHuot/master
Added listen IP parameter
This commit is contained in:
commit
b50deee77e
@ -1,5 +1,6 @@
|
|||||||
{
|
{
|
||||||
"debug": false,
|
"debug": false,
|
||||||
|
"host": "0.0.0.0",
|
||||||
"port": 9000,
|
"port": 9000,
|
||||||
"theme": "themes/example.css",
|
"theme": "themes/example.css",
|
||||||
"public": true
|
"public": true
|
||||||
|
@ -4,6 +4,7 @@ var program = require("commander");
|
|||||||
var shout = require("../server");
|
var shout = require("../server");
|
||||||
|
|
||||||
program
|
program
|
||||||
|
.option("-h, --host <ip>")
|
||||||
.option("-p, --port <port>")
|
.option("-p, --port <port>")
|
||||||
.command("start")
|
.command("start")
|
||||||
.description("Start the server")
|
.description("Start the server")
|
||||||
@ -15,7 +16,8 @@ program
|
|||||||
console.log("Create a new user with 'shout add <name>'.")
|
console.log("Create a new user with 'shout add <name>'.")
|
||||||
console.log("");
|
console.log("");
|
||||||
} else {
|
} else {
|
||||||
|
var host = program.host || config.host;
|
||||||
var port = program.port || config.port;
|
var port = program.port || config.port;
|
||||||
shout(port, config.public);
|
shout(port, host, config.public);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -26,15 +26,16 @@ var inputs = [
|
|||||||
"whois"
|
"whois"
|
||||||
];
|
];
|
||||||
|
|
||||||
module.exports = function(port, isPublic) {
|
module.exports = function(port, host, isPublic) {
|
||||||
config.port = port;
|
config.port = port;
|
||||||
|
config.host = host;
|
||||||
config.public = isPublic;
|
config.public = isPublic;
|
||||||
|
|
||||||
var app = http()
|
var app = http()
|
||||||
.use(index)
|
.use(index)
|
||||||
.use(http.static("client"))
|
.use(http.static("client"))
|
||||||
.use(http.static(process.env.HOME + "/.shout/cache"))
|
.use(http.static(process.env.HOME + "/.shout/cache"))
|
||||||
.listen(config.port);
|
.listen(config.port, config.host);
|
||||||
|
|
||||||
sockets = io(app);
|
sockets = io(app);
|
||||||
sockets.on("connect", function(socket) {
|
sockets.on("connect", function(socket) {
|
||||||
@ -46,7 +47,7 @@ module.exports = function(port, isPublic) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
console.log("");
|
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("Press ctrl-c to stop");
|
||||||
console.log("");
|
console.log("");
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user