diff options
author | Miranda Kastemaa | 2018-07-23 03:27:51 +0300 |
---|---|---|
committer | Miranda Kastemaa | 2018-07-27 15:35:29 +0300 |
commit | 70e8df5c04274ac4ee9d3eb2462fed12a85f6ccd (patch) | |
tree | 8fb5414afe6d4f055e61078c4d239d2bac2c9f9f /app.js | |
parent | 23bd1a18bb65dc49c55f755b02c9083ecdff1344 (diff) |
Support 'host' & 'path' config options
Signed-off-by: Miranda Kastemaa <miranda@foldplop.com>
Diffstat (limited to '')
-rw-r--r-- | app.js | 16 |
1 files changed, 13 insertions, 3 deletions
@@ -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 |