diff options
author | Kat Marchán <kzm@sykosomatic.org> | 2017-05-25 23:49:34 +0300 |
---|---|---|
committer | Rebecca Turner <me@re-becca.org> | 2017-05-26 04:55:32 +0300 |
commit | 1ab8c4157c37e5bf14798618d8b210cd9486db93 (patch) | |
tree | 8ed16c2c13da9a39e0edcd9784d9e8f5b752539b /lib/config/pacote.js | |
parent | 4df59348d5abb6ca4b2786ef73a22c67120ac95d (diff) |
pacote: send username/password auth through, too
Diffstat (limited to 'lib/config/pacote.js')
-rw-r--r-- | lib/config/pacote.js | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/lib/config/pacote.js b/lib/config/pacote.js index 530e33512..620a8b714 100644 --- a/lib/config/pacote.js +++ b/lib/config/pacote.js @@ -48,10 +48,21 @@ function pacoteOpts (moreOpts) { } npm.config.keys.forEach(function (k) { - if (k[0] === '/' && k.match(/.*:_authToken$/)) { + const authMatch = k[0] === '/' && k.match( + /(.*):(_authToken|username|_password|password|email|alwaysAuth)$/ + ) + if (authMatch) { + const nerfDart = authMatch[1] + const key = authMatch[2] + const val = npm.config.get(k) if (!opts.auth) { opts.auth = {} } - opts.auth[k.replace(/:_authToken$/, '')] = { - token: npm.config.get(k) + if (!opts.auth[nerfDart]) { opts.auth[nerfDart] = {} } + if (key === '_authToken') { + opts.auth[nerfDart].token = val + } else if (key.match(/password$/i)) { + opts.auth[nerfDart].password = val + } else { + opts.auth[nerfDart][key] = val } } if (k[0] === '@') { |