Sha256: 150202a608806d38af281541820f4e8e8e9d7baf3712b4c553889a5deb4a0f08
Contents?: true
Size: 1022 Bytes
Versions: 16
Compression:
Stored size: 1022 Bytes
Contents
require 'aws-sdk' require 'aws_config' module Awspec::Helper module CredentialsLoader def self.load(profile = nil) profile = ENV['AWS_PROFILE'] if profile.nil? if profile # SharedCredentials aws_config = AWSConfig.profiles[profile] aws_config = AWSConfig.profiles['default'] unless aws_config Aws.config[:region] = aws_config.config_hash[:region] if aws_config Aws.config[:credentials] = Aws::SharedCredentials.new(profile_name: profile) else # secrets.yml creds = YAML.load_file('spec/secrets.yml') if File.exist?('spec/secrets.yml') creds = YAML.load_file('secrets.yml') if File.exist?('secrets.yml') Aws.config.update({ region: creds['region'], credentials: Aws::Credentials.new( creds['aws_access_key_id'], creds['aws_secret_access_key']) }) if creds end end end end
Version data entries
16 entries across 16 versions & 1 rubygems