dotenv-rails

A Ruby gem to load environment variables from `.env`.
Icons/chart bar
Used 108 times
Created by
A Andrew Mason

Usage

Run this command in your Rails app directory in the terminal:

rails app:template LOCATION="https://railsbytes.com/script/zOvsQ0"
Template Source

Review the code before running this template on your machine.

def do_bundle
  Bundler.with_unbundled_env { run "bundle install" }
end

run 'bundle add dotenv-rails --group "development,test"'
do_bundle
inject_into_file "config/application.rb", "Dotenv::Railtie.load", after: "Bundler.require(*Rails.groups)\n"
inject_into_file ".gitignore", ".env"
file ".env", <<-CODE
export EXAMPLE=xxxxx
CODE
Comments

Sign up or Login to leave a comment.