Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/josudoey/nconf4policy

define configure value policy for nconf
https://github.com/josudoey/nconf4policy

Last synced: about 1 month ago
JSON representation

define configure value policy for nconf

Awesome Lists containing this project

README

        

# nconf4policy

## Installation

```bash
$ npm install nconf4policy
```

## Example

```js
var nconf = require('nconf4policy');
// policy priority 'file' > 'overrides' > 'defaults'

nconf.overrides({foo:'bar'});
nconf.get('foo');
// bar

nconf.defaults({foo:'helloworld'});
nconf.get('foo');
// bar

nconf.defaults({foo:'helloworld'});
// throw Error: duplicate configure key.

nconf.file({file:'/tmp/nconf.json'});
nconf.set('foo', 'helloworld');
nconf.get('foo');
// helloworld

nconf.save();
// { foo: 'helloworld' }
```