class AwsAuditor::AWSSDK
Constants
- FILE_NAMES
Public Class Methods
config_path()
click to toggle source
# File lib/aws_auditor/aws.rb, line 35 def self.config_path if filepath = FILE_NAMES.detect {|filename| File.exists?(filename)} File.join(Dir.pwd, filepath) else old_dir = Dir.pwd Dir.chdir('..') if old_dir != Dir.pwd config_path else puts "Could not find #{FILE_NAMES.join(' or ')}"; exit end end end
configuration(environment)
click to toggle source
# File lib/aws_auditor/aws.rb, line 13 def self.configuration(environment) @environment = environment load_config AWS.config({ :access_key_id => @config[:access_key_id], :secret_access_key => @config[:secret_access_key], :region => @config[:region] }) end
load_config()
click to toggle source
# File lib/aws_auditor/aws.rb, line 23 def self.load_config return @config if @config @config = AwsConfig[YAML.load_file(config_path)] if @config.has_key? @environment @config = @config[@environment] else puts "Could not find AWS credentials for #{@environment} environment"; exit end @config[:region] ||= 'us-east-1' @config end