Method: Codepipe::Setting#pipe_env

Defined in:
lib/codepipe/setting.rb

#pipe_envObject

Resolves infinite problem since Codepipe.env can be determined from PIPE_ENV or settings.yml files. When ufo is determined from settings it should not called Codepipe.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
47
48
49
# File 'lib/codepipe/setting.rb', line 36

def pipe_env
  path = "#{cb_root}/.codepipeline/settings.yml"
  if File.exist?(path)
    settings = YAML.load_file(path)
    env = settings.find do |_env, section|
      section ||= {}
      ENV['AWS_PROFILE'] && ENV['AWS_PROFILE'] == section['aws_profile']
    end
  end

  pipe_env = env.first if env
  pipe_env = ENV['PIPE_ENV'] if ENV['PIPE_ENV'] # highest precedence
  pipe_env || 'development'
end