Method: Ufo::Setting#ufo_env

Defined in:
lib/ufo/setting.rb

#ufo_envObject

Resovles infinite problem since Ufo.env can be determined from UFO_ENV or settings.yml files. When ufo is determined from settings it should not called Ufo.env since that in turn calls Settings.new.data which can then cause an infinite loop.



36
37
38
39
40
41
42
43
44
45
46
# File 'lib/ufo/setting.rb', line 36

def ufo_env
  settings = YAML.load_file("#{Ufo.root}/.ufo/settings.yml")
  env = settings.find do |_env, section|
    section ||= {}
    ENV['AWS_PROFILE'] && ENV['AWS_PROFILE'] == section['aws_profile']
  end

  ufo_env = env.first if env
  ufo_env = ENV['UFO_ENV'] if ENV['UFO_ENV'] # highest precedence
  ufo_env || 'development'
end