headless: print all available network addresses
This commit is contained in:
parent
bd7f56100e
commit
da0ed17f23
1 changed files with 11 additions and 1 deletions
|
|
@ -8,6 +8,7 @@ module.exports = function(settings) {
|
|||
server = http.createServer(express),
|
||||
io = require('socket.io')(),
|
||||
ioWildcard = require('socketio-wildcard')(),
|
||||
ifaces = require('os').networkInterfaces(),
|
||||
ipc = {}
|
||||
|
||||
express.get('/', function(req, res){
|
||||
|
|
@ -51,8 +52,17 @@ module.exports = function(settings) {
|
|||
});
|
||||
}
|
||||
|
||||
var appAddresses = []
|
||||
Object.keys(ifaces).forEach(function (ifname) {
|
||||
for (i=0;i<ifaces[ifname].length;i++) {
|
||||
if (ifaces[ifname][i].family == 'IPv4') {
|
||||
appAddresses.push('http://' + ifaces[ifname][i].address + ':' + settings.read('noGui'))
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
console.log('Headless mode: app available at http://127.0.0.1:'+settings.read('noGui'))
|
||||
|
||||
console.log('Headless mode: app available at ' + appAddresses.join(' & '))
|
||||
|
||||
return {
|
||||
ipc:ipc,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue