Method: Cody::Core#set_aws_profile!

Defined in:
lib/cody/core.rb

#set_aws_profile!Object

Overrides AWS_PROFILE based on the Cody.env if set in configs/settings.yml 2-way binding.



31
32
33
34
35
36
37
38
39
40
41
# File 'lib/cody/core.rb', line 31

def set_aws_profile!
  return if ENV['TEST']
  return unless File.exist?("#{Cody.root}/.cody/settings.yml") # for rake docs
  return unless settings # Only load if within Cody project and there's a settings.yml

  data = settings || {}
  if data[:aws_profile]
    puts "Using AWS_PROFILE=#{data[:aws_profile]} from CODY_ENV=#{Cody.env} in config/settings.yml"
    ENV['AWS_PROFILE'] = data[:aws_profile]
  end
end