From 84bfd23e7d6434d30595594723a6e1976e84b022 Mon Sep 17 00:00:00 2001 From: Valentin Ouvrard Date: Sat, 4 Aug 2018 03:09:39 +1100 Subject: [PATCH] config: stop filtering out non-ipv4 addresses from local-addrs (#35) Fixes: #986 PR-URL: https://github.com/npm/cli/pull/35 Credit: @valentin2105 Reviewed-By: @zkat --- lib/config/defaults.js | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/lib/config/defaults.js b/lib/config/defaults.js index ba885a3d46e33..21c6526571ea5 100644 --- a/lib/config/defaults.js +++ b/lib/config/defaults.js @@ -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, @@ -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 = {