https://github.com/zorro-del-caribe/config-loader
load namespaced configuration based on convention and environment variable (nodejs)
https://github.com/zorro-del-caribe/config-loader
Last synced: 7 months ago
JSON representation
load namespaced configuration based on convention and environment variable (nodejs)
- Host: GitHub
- URL: https://github.com/zorro-del-caribe/config-loader
- Owner: zorro-del-caribe
- License: mit
- Created: 2016-07-22T11:48:59.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2019-02-11T15:37:58.000Z (over 6 years ago)
- Last Synced: 2025-02-28T21:42:59.822Z (8 months ago)
- Language: JavaScript
- Homepage:
- Size: 26.4 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# conf-load
[](https://circleci.com/gh/zorro-del-caribe/config-loader)
load configuration based on namespaces and conventions.
## install
``npm install --save conf-load``
## usage
assuming you have
```
.
|
|---src
| |---conf
| |---foo.js
| |---bar.js```
with bar.js
```javascript
module.exports = {
some: 'thing',
another: {
thing: 'yeah'
}
};
```and foo.js
```Javascript
module.exports = { prop: 'value', woot: 'woot-value' };
```then use **conf-load**
```javascript
const {load} = require('conf-load');
const conf = load() // can pass options hereconf('foo.prop'); // > 'value'
conf('bar.another.thing'); // > 'yeah'
```### options
* directory: string -> the folder to read through to find the config files (default './src/conf')
* strict: boolean -> whether it should throw if it can not find a conf value at the corresponding path (default true) otherwise it returns undefined