Merge pull request #3 from christav/release-0.0.2
Updates for envconf 0.0.2 release
This commit is contained in:
Коммит
3268e1f159
25
README.md
25
README.md
|
@ -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"],
|
||||
|
|
Загрузка…
Ссылка в новой задаче