Method: HTTPX::Plugins::AwsSdkAuthentication.region

Defined in:
lib/httpx/plugins/aws_sdk_authentication.rb

.region(profile) ⇒ Object



65
66
67
68
69
70
71
72
# File 'lib/httpx/plugins/aws_sdk_authentication.rb', line 65

def region(profile)
  # https://github.com/aws/aws-sdk-ruby/blob/version-3/gems/aws-sdk-core/lib/aws-sdk-core/plugins/regional_endpoint.rb#L62
  keys = %w[AWS_REGION AMAZON_REGION AWS_DEFAULT_REGION]
  env_region = ENV.values_at(*keys).compact.first
  env_region = nil if env_region == ""
  cfg_region = Aws.shared_config.region(profile: profile)
  env_region || cfg_region
end