Class: Denv::Railtie

Inherits:
Rails::Railtie
  • Object
show all
Defined in:
lib/denv/rails.rb

Constant Summary collapse

DEFAULT_ENV_FILES =
%w[.env.local .env.#{Rails.env} .env]

Instance Method Summary collapse

Instance Method Details

#load_envObject



17
18
19
20
21
# File 'lib/denv/rails.rb', line 17

def load_env
  DEFAULT_ENV_FILES.map {|name| root.join(name) }.select(&:exist?).each do |path|
    Denv.load(path)
  end
end

#rootObject



23
24
25
# File 'lib/denv/rails.rb', line 23

def root
  Rails.root || Pathname.new(ENV['RAILS_ROOT'] || Dir.pwd)
end