read-dotenv-files

This repository contains small scripts as well as instructions to read .env files in several languages.

View the Project on GitHub Baelfire18/read-dotenv-files

Ruby Dotenv

For using it in ruby first you have to have:

  1. A Ruby version installed.

  2. Installed the ruby-dotenv gem. You can do it just by running gem install dotenv.

For a .env file like this:

require 'dotenv'

Dotenv.load('.env')

DB_NAME = ENV['DB_NAME']
p DB_NAME