hardlounge/src/command-line/start.js

24 lines
697 B
JavaScript
Raw Normal View History

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
.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 {
var host = program.host || config.host;
2014-08-19 01:18:40 +00:00
var port = program.port || config.port;
shout(port, host, config.public);
2014-08-19 01:18:40 +00:00
}
});