Skip to content
This repository has been archived by the owner on Aug 11, 2022. It is now read-only.

Commit

Permalink
Implement the config snapshot, so as to put configs into the lifecycl…
Browse files Browse the repository at this point in the history
…e env
  • Loading branch information
isaacs committed Aug 3, 2010
1 parent 609c12b commit 62df3c7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/utils/ini.js
Expand Up @@ -225,7 +225,8 @@ function rmConfigfile (configfile, cb) {
})
}
function get (key, which) {
return (!which) ? configList.get(key) // resolved
return (!key) ? configList.snapshot
: (!which) ? configList.get(key) // resolved
: configList.list[TRANS[which]] ? configList.list[TRANS[which]][key]
: undefined
}
Expand Down
5 changes: 5 additions & 0 deletions lib/utils/proto-list.js
Expand Up @@ -9,6 +9,11 @@ ProtoList.prototype =
for (var i in this.list[0]) k.push(i)
return k
}
, get snapshot () {
var o = {}
this.keys.forEach(function (k) { o[k] = this.get(k) })
return o
}
, push : function (obj) {
if (typeof obj !== "object") obj = {valueOf:obj}
if (this.list.length >= 1) {
Expand Down

0 comments on commit 62df3c7

Please sign in to comment.