feat: auto-enable path-style addressing when a custom endpoint is set #99
Reference in New Issue
Block a user
Delete Branch "feat/path-style-for-custom-endpoint"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
When
AWS_ENDPOINT_URL_S3orAWS_ENDPOINT_URLis set — typically because the runtime is pointing at a local MinIO / S3-compatible endpoint — auto-enable path-style addressing on the S3 client. Without this, requests fail because MinIO does not implement virtual-hosted style addressing out of the box.Production deployments leave those env vars unset and continue talking to real AWS S3 with virtual-hosted style — no behaviour change for prod.
Both
New()andNewS3()share as3ClientOptionshelper that applies the toggle.Motivation
Spinning up a MinIO-backed acctest environment for Shiny (document-service, invoice-service, accounting-service). Without this change callers would have to sidestep
storage.Newand construct anaws.Configby hand just to flipUsePathStyle.Test plan
TestS3ClientOptions_PathStyleTogglesOnCustomEndpointcovers the three relevant env-var statesgo test ./...passes🤖 Generated with Claude Code