simple-rc
a simple configuration loader
install
with npm, run
npm install --save simple-rc
what
given a list of file paths,
- an empty config object is created
- each file path is rendered as a template string with
process.env
passed as local variables - the contents of each file path is read synchronously
- the contents are assigned deeply into the config object
- the config object is returned
usage
pass options in js
// config.jsconst join = join moduleexports = files: "./config/${NODE_ENV}" "./config"
or in package.json
// config.jsmoduleexports =
to use in the browser
, we recommend browserify
and evalify
transform.
in your package.json, add
then when you require
your config.js
file from within your browser code, it will be exported as only the evaluated object.