Method: Pipedream::Setting#pipe_env

Defined in:
lib/pipedream/setting.rb

#pipe_envObject

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



40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/pipedream/setting.rb', line 40

def pipe_env
  path = "#{cb_root}/.pipedream/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