summaryrefslogtreecommitdiff
path: root/deps/npm/lib/npm.js
diff options
context:
space:
mode:
Diffstat (limited to 'deps/npm/lib/npm.js')
-rw-r--r--deps/npm/lib/npm.js16
1 files changed, 16 insertions, 0 deletions
diff --git a/deps/npm/lib/npm.js b/deps/npm/lib/npm.js
index 6113604f7..dd85b832b 100644
--- a/deps/npm/lib/npm.js
+++ b/deps/npm/lib/npm.js
@@ -275,10 +275,15 @@ function load (npm, conf, cb) {
// at this point the configs are all set.
// go ahead and spin up the registry client.
+ var token
+ try { token = JSON.parse(npm.config.get("_token")) }
+ catch (er) { token = null }
+
npm.registry = new RegClient(
{ registry: npm.config.get("registry")
, cache: npm.config.get("cache")
, auth: npm.config.get("_auth")
+ , token: token
, alwaysAuth: npm.config.get("always-auth")
, email: npm.config.get("email")
, proxy: npm.config.get("proxy")
@@ -293,8 +298,19 @@ function load (npm, conf, cb) {
, retryFactor: npm.config.get("fetch-retry-factor")
, retryMinTimeout: npm.config.get("fetch-retry-mintimeout")
, retryMaxTimeout: npm.config.get("fetch-retry-maxtimeout")
+ , cacheMin: npm.config.get("cache-min")
+ , cacheMax: npm.config.get("cache-max")
})
+ // save the token cookie in the config file
+ if (npm.registry.couchLogin) {
+ npm.registry.couchLogin.tokenSet = function (tok, cb) {
+ ini.set("_token", JSON.stringify(tok), "user")
+ // ignore save error. best effort.
+ ini.save("user", function () {})
+ }
+ }
+
var umask = parseInt(conf.umask, 8)
npm.modes = { exec: 0777 & (~umask)
, file: 0666 & (~umask)