2014-08-19 01:18:40 +00:00
|
|
|
var config = require("../../config.json");
|
|
|
|
var ClientManager = new require("../clientManager");
|
|
|
|
var program = require("commander");
|
|
|
|
var shout = require("../server");
|
|
|
|
|
|
|
|
program
|
2014-09-09 07:48:53 +00:00
|
|
|
.option("-h, --host <ip>")
|
2014-08-26 18:15:17 +00:00
|
|
|
.option("-p, --port <port>")
|
2014-08-19 01:18:40 +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-08 17:27:56 +00:00
|
|
|
console.log("Create a new user with 'shout add <name>'.")
|
2014-08-19 01:18:40 +00:00
|
|
|
console.log("");
|
|
|
|
} else {
|
2014-09-09 07:48:53 +00:00
|
|
|
var host = program.host || config.host;
|
2014-08-19 01:18:40 +00:00
|
|
|
var port = program.port || config.port;
|
2014-09-09 07:48:53 +00:00
|
|
|
shout(port, host, config.public);
|
2014-08-19 01:18:40 +00:00
|
|
|
}
|
|
|
|
});
|