# If you use gems that require environment variables to be set before they are
# loaded, then list `dotenv-rails` in the `Gemfile` before those other gems and
# require `dotenv/rails-now`.
#
#     gem "dotenv-rails", :require => "dotenv/rails-now"
#     gem "gem-that-requires-env-variables"
#

require "dotenv/rails"
Dotenv::Railtie.load

# If you use gems that require environment variables to be set before they are
# loaded, then list `dotenv-rails` in the `Gemfile` before those other gems and
# require `dotenv/rails-now`.
#
#     gem "dotenv-rails", :require => "dotenv/rails-now"
#     gem "gem-that-requires-env-variables"
#

# Needed for dotenv to work in Rails 3.0
# https://github.com/bkeepers/dotenv/issues/151
module Rails
  class Railtie
     def self.instance
       @instance ||= new
     end
  end
end
require "dotenv/rails"

Dotenv::Railtie.load

Add Rails 3 monkey patch to deal with missing ivar prior to load.
Add Rails 3 monkey patch to deal with missing ivar prior to load.

  * Can't put this in application.rb since dotenv needs to set env before loading other gems.
  * Rails environment must be set prior to load for rspec tests or else the development db is configured
  * https://github.com/bkeepers/dotenv/issues/45
