Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
config: stop filtering out non-ipv4 addresses from local-addrs (#35)
Fixes: #986
PR-URL: #35
Credit: @valentin2105
Reviewed-By: @zkat
  • Loading branch information
valentin2105 authored and zkat committed Aug 3, 2018
1 parent af98e76 commit 84bfd23
Showing 1 changed file with 3 additions and 12 deletions.
15 changes: 3 additions & 12 deletions lib/config/defaults.js
Expand Up @@ -306,8 +306,6 @@ exports.types = {
key: [null, String],
'legacy-bundling': Boolean,
link: Boolean,
// local-address must be listed as an IP for a local network interface
// must be IPv4 due to node bug
'local-address': getLocalAddresses(),
loglevel: ['silent', 'error', 'warn', 'notice', 'http', 'timing', 'info', 'verbose', 'silly'],
logstream: Stream,
Expand Down Expand Up @@ -388,16 +386,9 @@ function getLocalAddresses () {
interfaces = {}
}

return Object.keys(interfaces).map(function (nic) {
return interfaces[nic].filter(function (addr) {
return addr.family === 'IPv4'
})
.map(function (addr) {
return addr.address
})
}).reduce(function (curr, next) {
return curr.concat(next)
}, []).concat(undefined)
return Object.keys(interfaces).map(
nic => interfaces[nic].map(({address}) => address)
).reduce((curr, next) => curr.concat(next), []).concat(undefined)
}

exports.shorthands = {
Expand Down

0 comments on commit 84bfd23

Please sign in to comment.