conf-load
v3.0.1
Published
go through a config folder to namespace configuration values and load values
Downloads
2
Maintainers
Readme
conf-load
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
module.exports = {
some: 'thing',
another: {
thing: 'yeah'
}
};
and foo.js
module.exports = { prop: 'value', woot: 'woot-value' };
then use conf-load
const {load} = require('conf-load');
const conf = load() // can pass options here
conf('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