aws / aws/aws-sdk-ruby

Feature request: pre-populate Aws.config from environment

Open
#2,112 9 comments 0 reactions 0 assignees View on GitHub
feature-request needs-major-version
Dominant language
Ruby
Stars
3.7k
Forks
1.2k
Avg merge
1d 4h
Merged PRs (30d)
5

Description

### Issue description

Would it be feasible to pre-populate `Aws.config` from the runtime environment? For example, if `ENV["AWS_REGION"]` is set (and non-empty), then by default `Aws.config[:region] == ENV["AWS_REGION"]`. Likewise for any settings picked up from "~/.aws" or elsewhere.

This would enable in-app configuration code like the following:
```ruby
Aws.config[:region] ||= "us-east-1"
```

Where a reasonable default is provided, but can overridden from the outside, without code modification.

Additionally, it may be useful when one wants to test what config values are being picked up from the environment, for example, when debugging.

### Gem name ('aws-sdk', 'aws-sdk-resources' or service gems like 'aws-sdk-s3') and its version

`aws-sdk`

### Version of Ruby, OS environment

any

### Code snippets / steps to reproduce

N/A

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.