Make sure server is running before loading users

This commit is contained in:
Jérémie Astori 2017-08-23 01:19:50 -04:00
parent aa49856446
commit 684f1a641d
No known key found for this signature in database
GPG Key ID: B9A4F245CD67BDE8

View File

@ -89,16 +89,19 @@ module.exports = function() {
}, () => { }, () => {
const protocol = config.https.enable ? "https" : "http"; const protocol = config.https.enable ? "https" : "http";
var address = server.address(); var address = server.address();
log.info(`Available on ${colors.green(protocol + "://" + address.address + ":" + address.port + "/")} \
in ${config.public ? "public" : "private"} mode`);
});
var sockets = io(server, { log.info(
"Available at " +
colors.green(`${protocol}://${address.address}:${address.port}/`) +
` in ${colors.bold(config.public ? "public" : "private")} mode`
);
const sockets = io(server, {
serveClient: false, serveClient: false,
transports: config.transports transports: config.transports
}); });
sockets.on("connect", function(socket) { sockets.on("connect", (socket) => {
if (config.public) { if (config.public) {
performAuthentication.call(socket, {}); performAuthentication.call(socket, {});
} else { } else {
@ -112,6 +115,7 @@ in ${config.public ? "public" : "private"} mode`);
new Identification((identHandler) => { new Identification((identHandler) => {
manager.init(identHandler, sockets); manager.init(identHandler, sockets);
}); });
});
}; };
function getClientIp(request) { function getClientIp(request) {