From a976fa1ec47c6ced0c7453ad6bfdda6ad3ffe2ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kat=20March=C3=A1n?= Date: Thu, 25 May 2017 15:34:52 -0700 Subject: pacote: more alwaysAuth logic --- lib/config/pacote.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'lib') 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 } -- cgit v1.2.3