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
diff options
context:
space:
mode:
authorisaacs <i@izs.me>2011-06-05 21:27:57 +0400
committerisaacs <i@izs.me>2011-06-05 21:27:57 +0400
commit7fa556e4267cfb54f281b7d543bf6a789c9590ec (patch)
tree0b3f405fd7674877e2bd1cb128bc3fe8aa7df180
parent6b42a70eab91ef10cdc413518787e88fc56085e3 (diff)
Close #1008 Parse auth in config file (whoops)
-rw-r--r--lib/utils/ini.js7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/utils/ini.js b/lib/utils/ini.js
index 267ad4b8d..26f971c5e 100644
--- a/lib/utils/ini.js
+++ b/lib/utils/ini.js
@@ -174,7 +174,7 @@ function parseFile (file, cb) {
Object.keys(d).forEach(function (k) {
f[k] = parseField(d[k], k)
})
- return cb(null, f)
+ cb(null, parseAuth(f))
})
}
@@ -182,12 +182,13 @@ function encryptAuth (config, cb) {
if (config.username && config._password) {
config._auth = base64.encode(config.username+":"+config._password)
}
- delete config.username
- delete config._password
+ config.username = undefined
+ config._password = undefined
return cb(null, config)
}
function parseAuth (config) {
+ //console.error("parsing config %j", config)
if (!config._auth) return config
var unpw = base64.decode(config._auth).split(":")
, un = unpw.shift()