Enforce environment variable requirements.
Storing configuration in the environment is one of the tenets of a twelve-factor app. However, problems arise when required environment variables aren't set.
Usage
Add your required ENV keys to .envforcer.yml:
- REQUIRED_KEY1
- REQUIRED_KEY2
- REQUIRED_KEY3When the app starts, envforcer will check that all the required variables are set, and raise an error if they are not. This will prevent the app from starting.
Note: Currently only tested with Heroku. Will cause push to be rejected.
Installation
Rails
Add this line to your application's Gemfile:
gem 'envforcer', require: 'envforcer-rails'And then execute:
$ bundle
This will add a Railtie to enforce environment variables after_initialize.
Other Frameworks
At the time you wish to enforce the environment variables, add the line:
Envforcer.enforceContributing
We welcome pull requests. Please make sure tests accompany any PRs.
Curated by the good people at MojoTech.
(psst, we're hiring)