Sha256: de97c5d1f3c080dd836833fe92bd197e6f4e5c52a239a8a48dabb3dedacbefa9

Contents?: true

Size: 842 Bytes

Versions: 43

Compression:

Stored size: 842 Bytes

Contents

# frozen_string_literal: true

require_relative "abstract_factory"

class AwsAssumeRole::Credentials::Factories::Environment < AwsAssumeRole::Credentials::Factories::AbstractFactory
    type :credential_provider
    priority 10

    def initialize(_options, **)
        key =    %w[AWS_ACCESS_KEY_ID AMAZON_ACCESS_KEY_ID AWS_ACCESS_KEY]
        secret = %w[AWS_SECRET_ACCESS_KEY AMAZON_SECRET_ACCESS_KEY AWS_SECRET_KEY]
        token =  %w[AWS_SESSION_TOKEN AMAZON_SESSION_TOKEN]
        region = %w[AWS_DEFAULT_REGION]
        profile = %w[AWS_PROFILE]
        @credentials = Aws::Credentials.new(envar(key), envar(secret), envar(token))
        @region = envar(region)
        @profile = envar(profile)
    end

    def envar(keys)
        keys.each do |key|
            return ENV[key] if ENV.key?(key)
        end
        nil
    end
end

Version data entries

43 entries across 43 versions & 1 rubygems

Version Path
aws_assume_role-1.2.3-universal-freebsd lib/aws_assume_role/credentials/factories/environment.rb
aws_assume_role-1.2.3-universal-darwin lib/aws_assume_role/credentials/factories/environment.rb
aws_assume_role-1.2.3-universal-linux lib/aws_assume_role/credentials/factories/environment.rb
aws_assume_role-1.2.3-universal-openbsd lib/aws_assume_role/credentials/factories/environment.rb
aws_assume_role-1.2.3 lib/aws_assume_role/credentials/factories/environment.rb
aws_assume_role-1.2.3-linux lib/aws_assume_role/credentials/factories/environment.rb
aws_assume_role-1.2.2-universal-darwin lib/aws_assume_role/credentials/factories/environment.rb
aws_assume_role-1.2.2-universal-linux lib/aws_assume_role/credentials/factories/environment.rb
aws_assume_role-1.2.2-linux lib/aws_assume_role/credentials/factories/environment.rb
aws_assume_role-1.2.2-universal-openbsd lib/aws_assume_role/credentials/factories/environment.rb
aws_assume_role-1.2.2-universal-freebsd lib/aws_assume_role/credentials/factories/environment.rb
aws_assume_role-1.2.2 lib/aws_assume_role/credentials/factories/environment.rb
aws_assume_role-1.2.1 lib/aws_assume_role/credentials/factories/environment.rb
aws_assume_role-1.2.1-linux lib/aws_assume_role/credentials/factories/environment.rb
aws_assume_role-1.2.1-universal-openbsd lib/aws_assume_role/credentials/factories/environment.rb
aws_assume_role-1.2.1-universal-darwin lib/aws_assume_role/credentials/factories/environment.rb
aws_assume_role-1.2.1-universal-freebsd lib/aws_assume_role/credentials/factories/environment.rb
aws_assume_role-1.2.1-universal-linux lib/aws_assume_role/credentials/factories/environment.rb
aws_assume_role-1.2.0 lib/aws_assume_role/credentials/factories/environment.rb
aws_assume_role-1.2.0-linux lib/aws_assume_role/credentials/factories/environment.rb