Skip to content

load namespaced configuration based on convention and environment variable (nodejs)

License

Notifications You must be signed in to change notification settings

zorro-del-caribe/config-loader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

conf-load

CircleCI

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

About

load namespaced configuration based on convention and environment variable (nodejs)

Resources

License

Stars

Watchers

Forks

Packages

No packages published