2014-09-13 16:41:11 +00:00
|
|
|
var config = require("../../config");
|
2014-09-09 11:12:23 +00:00
|
|
|
var ClientManager = new require("../clientManager");
|
|
|
|
var program = require("commander");
|
|
|
|
var shout = require("../server");
|
|
|
|
|
|
|
|
program
|
2014-09-09 20:06:26 +00:00
|
|
|
.option("-h, --host <ip>", "host")
|
|
|
|
.option("-p, --port <port>", "port")
|
2014-09-09 11:12:23 +00:00
|
|
|
.command("start")
|
|
|
|
.description("Start the server")
|
|
|
|
.action(function() {
|
|
|
|
var users = new ClientManager().getUsers();
|
|
|
|
if (!config.public && !users.length) {
|
|
|
|
console.log("");
|
|
|
|
console.log("No users found!");
|
2014-09-13 17:16:07 +00:00
|
|
|
console.log("Create a new user with 'shout add <name>'.");
|
2014-09-09 11:12:23 +00:00
|
|
|
console.log("");
|
|
|
|
} else {
|
|
|
|
var host = program.host || process.env.IP || config.host;
|
|
|
|
var port = program.port || process.env.PORT || config.port;
|
|
|
|
shout(port, host, config.public);
|
|
|
|
}
|
|
|
|
});
|