diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/config/pacote.js | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/config/pacote.js b/lib/config/pacote.js index 43c5300fc..185ee922f 100644 --- a/lib/config/pacote.js +++ b/lib/config/pacote.js @@ -50,14 +50,18 @@ function pacoteOpts (moreOpts) { npm.config.keys.forEach(function (k) { const authMatch = k[0] === '/' && k.match( - /(.*):(_authToken|username|_password|password|email|always-auth|alwaysAuth)$/ + /(.*):(_authToken|username|_password|password|email|always-auth)$/ ) if (authMatch) { const nerfDart = authMatch[1] const key = authMatch[2] const val = npm.config.get(k) if (!opts.auth) { opts.auth = {} } - if (!opts.auth[nerfDart]) { opts.auth[nerfDart] = {} } + if (!opts.auth[nerfDart]) { + opts.auth[nerfDart] = { + alwaysAuth: !!npm.config.get('always-auth') + } + } if (key === '_authToken') { opts.auth[nerfDart].token = val } else if (key.match(/password$/i)) { @@ -66,7 +70,7 @@ function pacoteOpts (moreOpts) { // the actual username/password pair. Buffer.from(val, 'base64').toString('utf8') } else if (key === 'always-auth') { - opts.auth[nerfDart].alwaysAuth = val + opts.auth[nerfDart].alwaysAuth = val === 'false' ? false : !!val } else { opts.auth[nerfDart][key] = val } |