Switch config to YAML
This commit is contained in:
parent
0a2dd6cbbe
commit
4a2366eb06
11 changed files with 251 additions and 134 deletions
|
|
@ -4,6 +4,7 @@ var Logger = require("../logger");
|
|||
var db = require("../database");
|
||||
var User = require("../user");
|
||||
var Server = require("../server");
|
||||
var Config = require("../config");
|
||||
var $util = require("../utilities");
|
||||
|
||||
var CONNECT_RATE = {
|
||||
|
|
@ -89,7 +90,7 @@ function handleConnection(sock) {
|
|||
}
|
||||
|
||||
ipCount[ip]++;
|
||||
if (ipCount[ip] > srv.cfg["ip-connection-limit"]) {
|
||||
if (ipCount[ip] > Config.get("io.ip-connection-limit")) {
|
||||
sock.emit("kick", {
|
||||
reason: "Too many connections from your IP address"
|
||||
});
|
||||
|
|
@ -117,11 +118,11 @@ function handleConnection(sock) {
|
|||
|
||||
module.exports = {
|
||||
init: function (srv) {
|
||||
var ioport = srv.cfg["io-port"];
|
||||
var webport = srv.cfg["web-port"];
|
||||
var ioport = Config.get("io.port");
|
||||
var webport = Config.get("http.port");
|
||||
var app;
|
||||
if (ioport !== webport) {
|
||||
app = require("express")().listen(ioport, srv.cfg["express-host"]);
|
||||
app = require("express")().listen(ioport, Config.get("http.host"));
|
||||
srv.ioWeb = app;
|
||||
} else {
|
||||
app = srv.express;
|
||||
|
|
@ -132,7 +133,7 @@ module.exports = {
|
|||
srv.io.set("authorization", handleAuth);
|
||||
srv.io.on("connection", handleConnection);
|
||||
|
||||
if (srv.cfg["enable-ssl"]) {
|
||||
if (Config.get("https.enabled")) {
|
||||
srv.ioSecure = sio.listen(srv.https);
|
||||
srv.ioSecure.set("log level", 1);
|
||||
srv.ioSecure.set("authorization", handleAuth);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue