Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorKat Marchán <kzm@sykosomatic.org>2017-05-26 01:34:52 +0300
committerRebecca Turner <me@re-becca.org>2017-05-26 04:55:34 +0300
commita976fa1ec47c6ced0c7453ad6bfdda6ad3ffe2ce (patch)
tree1f2e3b2ef6bc06f4188e6dd99269fdeaeccb9bc8 /lib
parent046f967630935592a0da2f7a68de1ec55b481533 (diff)
pacote: more alwaysAuth logic
Diffstat (limited to 'lib')
-rw-r--r--lib/config/pacote.js10
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
}