Skip to content

Commit a976fa1

Browse files
zkatiarna
authored andcommittedMay 26, 2017
pacote: more alwaysAuth logic
1 parent 046f967 commit a976fa1

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed
 

‎lib/config/pacote.js

+7-3
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,18 @@ function pacoteOpts (moreOpts) {
5050

5151
npm.config.keys.forEach(function (k) {
5252
const authMatch = k[0] === '/' && k.match(
53-
/(.*):(_authToken|username|_password|password|email|always-auth|alwaysAuth)$/
53+
/(.*):(_authToken|username|_password|password|email|always-auth)$/
5454
)
5555
if (authMatch) {
5656
const nerfDart = authMatch[1]
5757
const key = authMatch[2]
5858
const val = npm.config.get(k)
5959
if (!opts.auth) { opts.auth = {} }
60-
if (!opts.auth[nerfDart]) { opts.auth[nerfDart] = {} }
60+
if (!opts.auth[nerfDart]) {
61+
opts.auth[nerfDart] = {
62+
alwaysAuth: !!npm.config.get('always-auth')
63+
}
64+
}
6165
if (key === '_authToken') {
6266
opts.auth[nerfDart].token = val
6367
} else if (key.match(/password$/i)) {
@@ -66,7 +70,7 @@ function pacoteOpts (moreOpts) {
6670
// the actual username/password pair.
6771
Buffer.from(val, 'base64').toString('utf8')
6872
} else if (key === 'always-auth') {
69-
opts.auth[nerfDart].alwaysAuth = val
73+
opts.auth[nerfDart].alwaysAuth = val === 'false' ? false : !!val
7074
} else {
7175
opts.auth[nerfDart][key] = val
7276
}

0 commit comments

Comments
 (0)
Please sign in to comment.