-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature request: pre-populate Aws.config from environment #2112
Comments
I think this feature already included. Here is the documentation https://github.com/aws/aws-sdk-ruby#configuration. Let me know if I missed anything. @jonathanhefner @cjyclaire |
I don't think so.
|
This may be a tricky one to implement. I would think that whatever configuration is resolved from the credential provider would need to be merged (or overwritten? unsure) into the |
We could implement it by using a block for defaults on Aws.config eg, when defining it: # lib/aws-sdk-core.rb
@config = Hash.new { |hash, key| hash[key] = Aws.shared_config.send(key) if Aws.shared_config.respond_to?(key) } I'm a little wary of making changes to default behavior of Aws.config though. |
Marking as needs-major-version for now. |
@alextwoods Above code works. Question here is, what If |
It should prefer ENV over everything else. https://docs.aws.amazon.com/sdk-for-ruby/v3/developer-guide/setup-config.html#aws-ruby-sdk-setting-credentials |
Greetings! We’re closing this issue because it has been open a long time and hasn’t been updated in a while and may not be getting the attention it deserves. We encourage you to check if this is still an issue in the latest release and if you find that this is still a problem, please feel free to comment or open a new issue. |
Greetings! We’re closing this issue because it has been open a long time and hasn’t been updated in a while and may not be getting the attention it deserves. We encourage you to check if this is still an issue in the latest release and if you find that this is still a problem, please feel free to comment or open a new issue. |
Issue description
Would it be feasible to pre-populate
Aws.config
from the runtime environment? For example, ifENV["AWS_REGION"]
is set (and non-empty), then by defaultAws.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:
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
The text was updated successfully, but these errors were encountered: