hardlounge/src/command-line/start.js

40 lines
1008 B
JavaScript
Raw Normal View History

"use strict";
var ClientManager = new require("../clientManager");
var program = require("commander");
var server = require("../server");
var Helper = require("../helper");
program
2016-10-09 08:54:44 +00:00
.option("-H, --host <ip>", "host")
.option("-P, --port <port>", "port")
.option("-B, --bind <ip>", "bind")
.option(" --public", "mode")
.option(" --private", "mode")
.command("start")
.description("Start the server")
.action(function() {
var users = new ClientManager().getUsers();
var mode = Helper.config.public;
if (program.public) {
mode = true;
} else if (program.private) {
mode = false;
}
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>'.");
return;
}
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();
});