Barricade
Barricade is a small library that allows you to setup environment variable from a single env.yml
file. It parses the YAML file and loads all of the configuration values into the process.env
object.
It has built-in support for multiple NODE_ENV.
Installation
npm install --save barricade
Usage
Add the following line at the top of your application JS file:
The library expects a YAML file (env.yml
) at the root of your application. Given the following YAML file:
# env.yml APP_SECRET: hello_worldSTRIPE_SECRET_KEY: secret_key_for_both_development_and_test production: STRIPE_SECRET_KEY: secret_key_used_only_in_production
You can then start your application and access those values from the process.env
object. Example:
// index.js console // hello_worldconsole // secret_key_for_both_development_and_test // Switch the Node environment to productionprocessenvNODE_ENV = 'production' console // secret_key_used_only_in_production
Licence
MIT