Skip to content

fuseraft/envl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Envl (.env loader)

A simple environment variable loader that reads .env files into ENV.

You can find the gem here: Envl

Installation

gem install envl

Basic usage

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]}"}

Methods

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.

More examples

Automatically loading .env files (if any exist in the current directory) into ENV.

Envl.auto_load

Loading 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]}"}

About

A simple environment variable loader that reads .env files.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages