From 1c0f6f2e2a68d6160df3ae4b45d4bb555a055781 Mon Sep 17 00:00:00 2001 From: Devin Howard Date: Thu, 7 Jan 2016 18:47:58 +0800 Subject: [PATCH] don't put RAILS_ENV into the .env file - chicken and egg see https://github.com/bkeepers/dotenv/issues/19 for more info --- .example-env | 2 -- config/application.rb | 4 ++++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.example-env b/.example-env index dc7f8a3e..f547b8c6 100644 --- a/.example-env +++ b/.example-env @@ -1,5 +1,3 @@ -export RAILS_ENV='development' - export DB_USERNAME='postgres' export DB_PASSWORD='3112' export DB_HOST='localhost' diff --git a/config/application.rb b/config/application.rb index 93bdb8bf..399b32c9 100644 --- a/config/application.rb +++ b/config/application.rb @@ -1,9 +1,13 @@ require File.expand_path('../boot', __FILE__) require 'rails/all' +require 'dotenv' Bundler.require(*Rails.groups) +ENV["RAILS_ENV"] ||= ENV["RACK_ENV"] || "development" +Dotenv.load ".env.#{ENV["RAILS_ENV"]}", '.env' + module Metamaps class Application < Rails::Application # Settings in config/environments/* take precedence over those specified here.