diff options
author | isaacs <i@izs.me> | 2011-02-17 01:36:22 +0300 |
---|---|---|
committer | isaacs <i@izs.me> | 2011-02-17 01:36:22 +0300 |
commit | 4f609462e86d5ce22bf2bbb00d534ff8df472727 (patch) | |
tree | 16d6a7bdabeedb9ef2e1a2f6b28b72b8ba6a0519 | |
parent | 162166c96bbb8ce3d8ea9c5424c2c2a924c84679 (diff) |
Closes GH-592 Don't fail if no auth is found
-rw-r--r-- | lib/utils/ini.js | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/utils/ini.js b/lib/utils/ini.js index e08c05196..b5dd342f8 100644 --- a/lib/utils/ini.js +++ b/lib/utils/ini.js @@ -76,6 +76,7 @@ function resolveConfigs (cli, cb) { }) }) } + function parseEnv (env) { var conf = {} Object.keys(env) @@ -87,6 +88,7 @@ function parseEnv (env) { }) return conf } + function unParseField (f, k) { // type can be an array or single thing. var isPath = -1 !== [].concat(parseArgs.types[k]).indexOf(path) @@ -102,6 +104,7 @@ function unParseField (f, k) { } return f } + function parseField (f, k) { if (typeof f !== "string" && !(f instanceof String)) return f // type can be an array or single thing. @@ -124,6 +127,7 @@ function parseField (f, k) { } return f } + function parseFile (file, cb) { if (!file) return cb(null, {}) log.verbose(file, "config file") @@ -137,14 +141,14 @@ function parseFile (file, cb) { decryptAuth(f, cb) }) } + function decryptAuth (config, cb) { - // todo: remove the _ kludgery in 1.0.0 - var proto = config.__proto__ - config.__proto__ = {} if (!config._authCrypt || !crypto.Decipher) { config.__proto__ = proto return cb(null, parseAuth(config)) } + var proto = config.__proto__ + config.__proto__ = {} getKey(function (er, key) { if (er) return log(er, "error getting key to decrypt auth", cb) if (!key) return log("Could not get key", "error decrypting auth", cb) @@ -164,6 +168,7 @@ function encryptAuth (config, cb) { } function parseAuth (config) { + if (!config._auth) return config var unpw = base64.decode(config._auth).split(":") , un = unpw.shift() , pw = unpw.join(":") |