From 70e8df5c04274ac4ee9d3eb2462fed12a85f6ccd Mon Sep 17 00:00:00 2001 From: Miranda Kastemaa Date: Mon, 23 Jul 2018 03:27:51 +0300 Subject: Support 'host' & 'path' config options Signed-off-by: Miranda Kastemaa --- app.js | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'app.js') diff --git a/app.js b/app.js index e2479137..24f0516f 100644 --- a/app.js +++ b/app.js @@ -205,11 +205,21 @@ io.sockets.on('connection', realtime.connection) // listen function startListen () { - server.listen(config.port, function () { + var address + var listenCallback = function () { var schema = config.useSSL ? 'HTTPS' : 'HTTP' - logger.info('%s Server listening at port %d', schema, config.port) + logger.info('%s Server listening at %s', schema, address) realtime.maintenance = false - }) + } + + // use unix domain socket if 'path' is specified + if (config.path) { + address = config.path + server.listen(config.path, listenCallback) + } else { + address = config.host + ':' + config.port + server.listen(config.port, config.host, listenCallback) + } } // sync db then start listen -- cgit v1.2.3