Merge pull request #3 from christav/release-0.0.2

Updates for envconf 0.0.2 release
This commit is contained in:
Glenn Block 2013-07-08 22:31:51 -07:00
Родитель 98609207c4 a6a9e087e2
Коммит 3268e1f159
2 изменённых файлов: 26 добавлений и 1 удалений

Просмотреть файл

@ -72,3 +72,28 @@ c3.configure('production', function (c) {
c.useSql('realDatabase', 'actualDb');
});
```
Are you making changes to a global configuration in your unit tests, and want
to ensure you've restored the state after your test? Use a snapshot:
```javascript
var c4 = envconf.createConfig();
c4.configure(function (c) {
c.set('originalValue', 'one');
});
// set up contents of c4
var snapshot = c4.snapshot();
c4.configure(function (c) {
c.set('originalValue', 'two');
});
c4.restore(snapshot);
c4.get('originalValue').should.equal('one');
```
Snapshot/restore also saves and restores any child configurations.

Просмотреть файл

@ -6,7 +6,7 @@
"Rodrigues, Andre <andrerod@microsoft.com>",
"Tavares, Chris <ctavares@microsoft.com>"
],
"version": "0.0.1",
"version": "0.0.2",
"description": "a module for express-style programmatic configuration",
"main": "lib/index.js",
"tags": ["config", "environment"],