A simple environment variable loader that reads .env files into ENV.
You can find the gem here: Envl
gem install envl
Add a require to your .rb file and call Envl#auto_load.
require 'envl'
# Automatically load .env file in current directory into ENV
Envl.auto_load
# Now we have a happy ENV!
Envl.keys.each {|v| puts "#{v}: #{ENV[v]}"}Envl#auto_load: Finds and loads .env files in the current directory into ENV.
Envl#keys: Returns all keys loaded into ENV via Envl.
Envl#load: Loads an array of .env files into ENV.
Envl#load_path: Finds and loads .env files in a specific directory into ENV.
Envl#load_single: Loads a single .env file into ENV.
Automatically loading .env files (if any exist in the current directory) into ENV.
Envl.auto_loadLoading multiple .env files into ENV.
Envl.load(['../app.env', 'settings.env'])Loading .env files in a specific directory into ENV.
Envl.load_path('..')Loading a single specific .env file into ENV.
Envl.load_single('../app.env')Printing all loaded keys and values in ENV loaded by Envl.
Envl.auto_load
Envl.keys.each {|v| puts "#{v}: #{ENV[v]}"}