mirror of
https://github.com/thelounge/thelounge
synced 2024-11-26 22:10:22 +00:00
Clean up server options
This commit is contained in:
parent
9cc793ef9e
commit
d1296abf12
2 changed files with 16 additions and 14 deletions
|
@ -1,14 +1,15 @@
|
|||
var _ = require("lodash");
|
||||
var ClientManager = new require("../clientManager");
|
||||
var program = require("commander");
|
||||
var shout = 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")
|
||||
.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() {
|
||||
|
@ -26,9 +27,11 @@ program
|
|||
console.log("Create a new user with 'shout add <name>'.");
|
||||
console.log("");
|
||||
} else {
|
||||
var host = program.host || process.env.IP || config.host;
|
||||
var port = program.port || process.env.PORT || config.port;
|
||||
var bind = program.bind || process.env.BIND || config.bind;
|
||||
shout(port, host, mode, bind);
|
||||
shout({
|
||||
host: program.host || config.host,
|
||||
port: program.port || config.port,
|
||||
bind: program.bind || config.bind,
|
||||
public: mode
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
|
@ -11,12 +11,9 @@ var config = {};
|
|||
var sockets = null;
|
||||
var manager = new ClientManager();
|
||||
|
||||
module.exports = function(port, host, isPublic, localIp) {
|
||||
module.exports = function(options) {
|
||||
config = Helper.getConfig();
|
||||
config.port = port;
|
||||
config.host = host;
|
||||
config.public = isPublic;
|
||||
config.bind = localIp;
|
||||
config = _.extend(config, options);
|
||||
|
||||
var app = express()
|
||||
.use(index)
|
||||
|
@ -25,6 +22,8 @@ module.exports = function(port, host, isPublic, localIp) {
|
|||
var server = null;
|
||||
var https = config.https || {};
|
||||
var protocol = https.enable ? "https" : "http";
|
||||
var port = config.port;
|
||||
var host = config.host;
|
||||
|
||||
if (!https.enable){
|
||||
server = require("http");
|
||||
|
|
Loading…
Reference in a new issue