
Security News
CISA’s 2025 SBOM Guidance Adds Hashes, Licenses, Tool Metadata, and Context
CISA’s 2025 draft SBOM guidance adds new fields like hashes, licenses, and tool metadata to make software inventories more actionable.
Envy is a simple module to define environment variable requirements, and to load those environment variables into Ruby constants. This is ideal for managing configuration settings using environment variables, as one would on Heroku.
Read the full API documentation for detailed API and usage instructions.
Add this line to your application's Gemfile:
gem 'envy'
And then execute:
% bundle
Or install it yourself as:
% gem install envy
envars.yml
fileFirst, define your requirements in a YAML file. By default, Envy will look for
./config/envars.yml
. For example:
---
&defaults:
- name: AWS_ACCESS_KEY
message: Please provide your Amazon AWS credentials as environment variables.
- name: AWS_ACCESS_SECRET
message: Please provide your Amazon AWS credentials as environment variables.
- name: HASHING_SALT
production:
<<: *defaults
development:
<<: *defaults
You can define your required environment variables by name, and also provide an optional custom exception message to be used when that variable is not set.
To read the requirements and inspect the current environment variables,
simply call Envy.init
. This will raise an exception if requirements are not
met. When working with Rails apps, you might want to use this is an
initializer.
A common pattern is to define custom environment variables in a .env
file
in your application's root directory. Other gems, such as [Foreman][] will
use such a file to augment the environment before running processes. When in
development mode, Envy can also do this for you. Simply tell it which file to
use:
Envy.init parse: '.env'
It is a good idea to not include such a file (which commonly contains application secrets) in source control.
Envy will expose all the loaded environment variables as constants in the Envy module, so you can access them as:
Envy::MY_VARIABLE
You could also opt to extend your Rails configuration object:
Envy.init use: MyApp::Application.config
MyApp::Application.config.my_variable # => ...
git checkout -b my-new-feature
)git commit -am 'Add some feature'
)git push origin my-new-feature
)FAQs
Unknown package
We found that envi demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
CISA’s 2025 draft SBOM guidance adds new fields like hashes, licenses, and tool metadata to make software inventories more actionable.
Security News
A clarification on our recent research investigating 60 malicious Ruby gems.
Security News
ESLint now supports parallel linting with a new --concurrency flag, delivering major speed gains and closing a 10-year-old feature request.