Skip to content
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

storage/s3: endpoint_url from AWS config file #591

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

jsproede
Copy link

Hi 👋

We've used this tool a lot since we've discovered s5cmd for our S3 buckets. As we're not using AWS, we need to set the S3_ENDPOINT_URL each time we open a new Terminal.

As the AWS-CLI officially supports endpoint_url in the AWS config file for a profile, I thought it would be great if s5cmd would support endpoint_url in AWS config profiles as well. Unfortunately the AWS-SDK does not support endpoint_url, therefore we're using the go-ini module to read the AWS config file.

Therefore we extended the newSession function to use either the configured AWS config file (via AWS_CONFIG_FILE env-variable) or the default AWS config file ($HOME/.aws/config) and lookup/use the endpoint_url for the specified profile (only if configured and not specified by $S3_ENDPOINT_URL or the --endpoint-url-flag).

Additionally we created a test which covers the config file including a endpoint_url and a profile which has not set the endpoint_url.

What do you think about this?

If there is anything missing or we need to change something in this pull request, feel free to let us know 🙂

@jsproede jsproede requested a review from a team as a code owner July 14, 2023 06:16
@jsproede jsproede requested review from igungor and seruman and removed request for a team July 14, 2023 06:16
@jsproede jsproede marked this pull request as draft July 14, 2023 07:03
@jsproede
Copy link
Author

I forgot, that AWS config profiles must be prefixed with profile. After pushing my changes the "ci / test (windows/go-1.17.x) (pull_request)" is now failing 🤔 I'll mark my PR as ready again. Can someone look into it (maybe restart the failing job)?

@jsproede jsproede marked this pull request as ready for review July 14, 2023 07:08
@tilimil
Copy link

tilimil commented Sep 20, 2023

What about the "region" and "ca_bundle" in the config file as well? It appears these aren't being consumed by s5cmd either. Is there a more complete way to bring in all the setting in the config file and pass those to the SDK?

@yakimant
Copy link

yakimant commented Oct 5, 2023

Thanks for the PR, looking forward for it being merged.
Thanks to the reviewers in advance!

@jsproede
Copy link
Author

jsproede commented Oct 6, 2023

What about the "region" and "ca_bundle" in the config file as well? It appears these aren't being consumed by s5cmd either. Is there a more complete way to bring in all the setting in the config file and pass those to the SDK?

@tilimil Great suggestion. We've mainly focused on the endpoint-URL. I'm not sure, if the SDK could properly handle region and ca_bundle itself and therefore go-ini would not be necessary for these two configuration properties. I need to take a deeper look into the code of s5cmd to properly answer that. Maybe one of the maintainers can help us with that? :)

@MrWaip
Copy link

MrWaip commented Oct 18, 2023

Hi! It's nice feature to have

@k0ste
Copy link

k0ste commented Feb 19, 2024

Needs rebase

@jsproede
Copy link
Author

@k0ste Since the PR has now been open since July 2023, I wanted to save myself the time of working on a regular rebase as long as there is no feedback, because I don't even know yet whether the PR would be accepted at all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants