https://github.com/denrox/incremental-config
Incremental config sequences for nodejs. Allows to get a combined config object from different sources
https://github.com/denrox/incremental-config
Last synced: over 1 year ago
JSON representation
Incremental config sequences for nodejs. Allows to get a combined config object from different sources
- Host: GitHub
- URL: https://github.com/denrox/incremental-config
- Owner: Denrox
- License: mit
- Created: 2017-12-01T09:54:39.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-12-04T10:27:10.000Z (over 8 years ago)
- Last Synced: 2025-01-21T17:11:15.083Z (over 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 21.5 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
- License: LICENSE
Awesome Lists containing this project
README
## Installation
Requires nodejs >= 7.6
```bash
$ npm i incremental-config
```
## Features
* Combines configuration object from different sources
* Supports YAML, JSON files and common JS objects
* Allows to adjust priority of some config source by changing it's position in sequence
## Examples
Here is a simple usage example:
```bash
$ npm i incremental-config
```
```javascript
async function main() {
let ic = require('incremental-config'),
config = null;
config = await ic([
//following configuration source will have the lowest priority
{
type: 'json',
source: {
path: './test.json',
charset: 'latin1'
}
},
//higher priority for this one
{
type: 'yml',
source: {
path: './test.yml' //utf8 charset is applied when none specified
}
},
//this source will have the highest priority.
//it will override properties with same names from other sources
{
source: {
testValue: 'someValue'
}
}
]);
console.log(config);
}
main();
```
The result of this code will be a config object which has merged contents of all listed sources.
## License
[MIT](LICENSE)