2016-10-09 19:14:02 +00:00
|
|
|
"use strict";
|
|
|
|
|
2014-09-09 11:12:23 +00:00
|
|
|
var ClientManager = new require("../clientManager");
|
|
|
|
var program = require("commander");
|
2016-02-10 05:47:03 +00:00
|
|
|
var server = require("../server");
|
2014-10-01 15:59:35 +00:00
|
|
|
var Helper = require("../helper");
|
2014-09-09 11:12:23 +00:00
|
|
|
|
|
|
|
program
|
2014-10-11 12:35:28 +00:00
|
|
|
.option("-H, --host <ip>" , "host")
|
|
|
|
.option("-P, --port <port>" , "port")
|
|
|
|
.option("-B, --bind <ip>" , "bind")
|
|
|
|
.option(" --public" , "mode")
|
|
|
|
.option(" --private" , "mode")
|
2014-09-09 11:12:23 +00:00
|
|
|
.command("start")
|
|
|
|
.description("Start the server")
|
|
|
|
.action(function() {
|
|
|
|
var users = new ClientManager().getUsers();
|
2016-06-08 09:26:24 +00:00
|
|
|
|
|
|
|
var mode = Helper.config.public;
|
2014-10-01 19:05:07 +00:00
|
|
|
if (program.public) {
|
|
|
|
mode = true;
|
|
|
|
} else if (program.private) {
|
|
|
|
mode = false;
|
|
|
|
}
|
2016-06-08 09:26:24 +00:00
|
|
|
|
2016-07-30 01:20:38 +00:00
|
|
|
if (!mode && !users.length && !Helper.config.ldap.enable) {
|
2016-04-16 11:32:38 +00:00
|
|
|
log.warn("No users found!");
|
|
|
|
log.info("Create a new user with 'lounge add <name>'.");
|
2016-06-08 09:26:24 +00:00
|
|
|
|
|
|
|
return;
|
2014-09-09 11:12:23 +00:00
|
|
|
}
|
2016-06-08 09:26:24 +00:00
|
|
|
|
|
|
|
Helper.config.host = program.host || Helper.config.host;
|
|
|
|
Helper.config.port = program.port || Helper.config.port;
|
|
|
|
Helper.config.bind = program.bind || Helper.config.bind;
|
|
|
|
Helper.config.public = mode;
|
|
|
|
|
|
|
|
server();
|
2014-09-09 11:12:23 +00:00
|
|
|
});
|