-
Notifications
You must be signed in to change notification settings - Fork 697
/
start.js
37 lines (31 loc) · 981 Bytes
/
start.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
var ClientManager = new require("../clientManager");
var program = require("commander");
var server = require("../server");
var Helper = require("../helper");
program
.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;
}
if (!mode && !users.length) {
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();
});