Class: AwsAssumeRole::Credentials::Factories::Environment
- Inherits:
-
AbstractFactory
- Object
- AbstractFactory
- AwsAssumeRole::Credentials::Factories::Environment
- Defined in:
- lib/aws_assume_role/credentials/factories/environment.rb
Constant Summary
Constants included from AwsAssumeRole::Credentials::Factories
Constants included from AwsAssumeRole
AwsAssumeRole::Config, DefaultProvider, VERSION
Instance Attribute Summary
Attributes inherited from AbstractFactory
#credentials, #profile, #region, #role_arn
Instance Method Summary collapse
- #envar(keys) ⇒ Object
-
#initialize(_options) ⇒ Environment
constructor
A new instance of Environment.
Methods inherited from AbstractFactory
priority, register_if_complete, type
Methods included from Logging
Methods included from AwsAssumeRole
Constructor Details
#initialize(_options) ⇒ Environment
Returns a new instance of Environment.
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/aws_assume_role/credentials/factories/environment.rb', line 9 def initialize(, **) 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 |
Instance Method Details
#envar(keys) ⇒ Object
20 21 22 23 24 25 |
# File 'lib/aws_assume_role/credentials/factories/environment.rb', line 20 def envar(keys) keys.each do |key| return ENV[key] if ENV.key?(key) end nil end |