Sha256: 7384a88e6ae643c0f0e7af47191c4a0655b30c96280a9a09087fd6088eec3d10
Contents?: true
Size: 1.05 KB
Versions: 4
Compression:
Stored size: 1.05 KB
Contents
require 'aws-sdk' require 'yaml' require 'hashie' module AwsAuditor class AwsConfig < Hash include Hashie::Extensions::IndifferentAccess end class AWSSDK FILE_NAMES = %w[.aws.yml] 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 def self.load_config return @config if @config @config = AwsConfig[YAML.load_file(config_path)] @config = @config[@environment] if @environment @config[:region] ||= 'us-east-1' @config end 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 end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
aws_auditor-0.1.2 | lib/aws_auditor/aws.rb |
aws_auditor-0.1.1 | lib/aws_auditor/aws.rb |
aws_auditor-0.1.0 | lib/aws_auditor/aws.rb |
aws_auditor-0.0.1 | lib/aws_auditor/aws.rb |