Class: GetaroundUtils::Railties::Dotenv

Inherits:
Rails::Railtie
  • Object
show all
Defined in:
lib/getaround_utils/railties/dotenv.rb

Instance Method Summary collapse

Instance Method Details

#loadObject



10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/getaround_utils/railties/dotenv.rb', line 10

def load
  if ENV['DOTENVS'].present?
    overrides = ENV['DOTENVS'].split(',').map{ |n| [".env.#{n}.local", ".env.#{n}"] }.flatten
    warn('=' * 100)
    warn("⚠️  ENV is overriden with the following profiles: #{overrides}")
    warn('=' * 100)
    Dotenv.load(*overrides)
  end
  Dotenv::Rails.load
  Dotenv.load('.env.all.local', '.env.all')
  nil
end