[2.x] Fixes support for S3-Compatible Storage like Herd minio #190
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently if you use vapor.js for file uploads, during local development you need to use a live aws account. There is no way to use cloudflare r2, minio, etc. for local development.
I created a minio service in herd to use for local storage development and was having weird issues where i either couldn't upload with vapor.js or render a public url for already uploaded files which these two issues would basically be toggled depending on my env configuration
Reproduce: create a minio service in herd and copy the env
Create a bucket in the MinIO dashboard
Problem:
AWS_URL
must include the bucket name (e.g., https://minio.herd.test/herd-bucket) to make public URLs work.AWS_URL
includes a path, that path is duplicated in the signed upload URL generated by VaporExamples:
Yields:
Yields:
Yields:
ignoring the
AWS_ENDPOINT
Fix:
The issue originates from how the S3 client is constructed in Vapor Core. It does not fully respect the configured disk settings and misuses
AWS_URL
as both the url and SDK endpoint.I've updated the controller to use AWS_ENDPOINT if it exists which seems to make vapor core work with herd minio now.