display a hostname-based URL on launch.. https docs..

This commit is contained in:
Lloyd Brookes
2015-12-13 12:40:24 +00:00
parent 882436699b
commit 7ca0da3d85
3 changed files with 49 additions and 13 deletions

View File

@ -71,10 +71,12 @@ function stop (msgs, exitCode) {
}
function onServerUp () {
const ipList = Object.keys(os.networkInterfaces())
let ipList = Object.keys(os.networkInterfaces())
.map(key => os.networkInterfaces()[key])
.reduce((prev, curr) => prev = prev.concat(curr), [])
.filter(iface => iface.family === 'IPv4')
ipList.unshift({ address: os.hostname() })
ipList = ipList
.map(iface => `[underline]{${isHttps ? 'https' : 'http'}://${iface.address}:${options.server.port}}`)
.join(', ')