2016-10-09 19:14:02 +00:00
|
|
|
"use strict";
|
|
|
|
|
2014-09-09 11:12:23 +00:00
|
|
|
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");
|
2017-08-21 05:49:32 +00:00
|
|
|
const Utils = require("./utils");
|
2014-09-09 11:12:23 +00:00
|
|
|
|
|
|
|
program
|
2016-12-15 06:29:44 +00:00
|
|
|
.command("start")
|
2017-02-18 03:23:01 +00:00
|
|
|
.option("-H, --host <ip>", "set the IP address or hostname for the web server to listen on")
|
|
|
|
.option("-P, --port <port>", "set the port to listen on")
|
|
|
|
.option("-B, --bind <ip>", "set the local IP to bind to for outgoing connections")
|
|
|
|
.option(" --public", "start in public mode")
|
|
|
|
.option(" --private", "start in private mode")
|
2014-09-09 11:12:23 +00:00
|
|
|
.description("Start the server")
|
2017-08-21 05:49:32 +00:00
|
|
|
.on("--help", Utils.extraHelp)
|
2016-12-15 06:29:44 +00:00
|
|
|
.action(function(options) {
|
2016-06-08 09:26:24 +00:00
|
|
|
var mode = Helper.config.public;
|
2016-12-15 06:29:44 +00:00
|
|
|
if (options.public) {
|
2014-10-01 19:05:07 +00:00
|
|
|
mode = true;
|
2016-12-15 06:29:44 +00:00
|
|
|
} else if (options.private) {
|
2014-10-01 19:05:07 +00:00
|
|
|
mode = false;
|
|
|
|
}
|
2016-06-08 09:26:24 +00:00
|
|
|
|
2016-12-15 06:29:44 +00:00
|
|
|
Helper.config.host = options.host || Helper.config.host;
|
|
|
|
Helper.config.port = options.port || Helper.config.port;
|
|
|
|
Helper.config.bind = options.bind || Helper.config.bind;
|
2016-06-08 09:26:24 +00:00
|
|
|
Helper.config.public = mode;
|
|
|
|
|
|
|
|
server();
|
2014-09-09 11:12:23 +00:00
|
|
|
});
|