Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Load environment variables from .env
files.
Add this line to your application's Gemfile:
gem "envoker"
And then execute:
$ bundle
Or install it yourself as:
$ gem install envoker
Load your .env
file in the application bootstrap
process:
# .env
RACK_ENV=development
# boot.rb
require "envoker"
Envoker.load
ENV["RACK_ENV"]
# => "development"
You can use Envoker#overload
to override
existing values in ENV
:
# .env.test
RACK_ENV=test
# boot.rb
# ...
Envoker.overload(".env.test")
ENV["RACK_ENV"]
# => "test"
Envoker::Rack
adds support for multiple environments:
require "envoker/rack"
Envoker::Rack.load
You should store env vars that are general to
all environments in .env
, and store specific
env vars in .env.<environment>
.The default
environment is development
, but can be changed
through ENV["RACK_ENV"]
.
ENV["RACK_ENV"] = "test"
# This will load `.env` and `.env.test`
Envoker::Rack.load
This is a common pattern I use in my applications:
require "envoker/rack"
Envoker::Rack.load
module Settings
def self.fetch(key)
return ENV.fetch(key) do
raise(sprintf("ENV[%p] not found", key))
end
end
REDIS_URL = fetch("REDIS_URL")
SMTP_URL = fetch("SMTP_URL")
end
Settings::SMTP_URL
# => redis://localhost:6379
Fork the project with:
$ git clone https://github.com/frodsan/envoker.git
To install dependencies, use:
$ bundle install
To run the test suite, do:
$ rake test
For bug reports and pull requests use GitHub.
Envoker is released under the MIT License.
FAQs
Unknown package
We found that envoker 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.