-
Notifications
You must be signed in to change notification settings - Fork 10
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
fix: Add optional S3 endpoint to upload arguments #110
fix: Add optional S3 endpoint to upload arguments #110
Conversation
This update introduces an optional `endpoint` field to the `S3UploadArgs` struct, allowing users to specify a custom AWS S3 compatibility endpoint. The deployment function has been modified to utilize this new endpoint if provided, otherwise defaulting to the standard S3 URL format. This enhances flexibility for users working with different S3-compatible services.
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Nice one, looks good to me. Happy to approve once the CI checks pass. Also just a heads up, I'm working on a refactor for the CLI so it should be a bit more clear which args you actually need for what command etc. 🙂 |
cli/src/deploy.rs
Outdated
object_store::path::Path::from(format!("{}-{}", manifest.name, manifest.image_id)); | ||
|
||
let url = if let Some(endpoint) = endpoint { | ||
format!("{}", endpoint) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since endpoint
is already a String
here I believe you can just return that instead of creating a new String
with the format!
macro
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For even more style points you could try (didn't test it but should be close):
let url = endpoint.unwrap_or(format!("https://{}.s3.{}.amazonaws.com/{}", bucket, region, dest));
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch! I’ve updated the code to return the existing endpoint directly instead of using format!. Thanks for pointing it out!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks again for this @kidneyweakx 🙂
Description
Add an optional
endpoint
field in theS3UploadArgs
struct. Users can now specify a custom AWS S3-compatible endpoint, enhancing the deployment function's flexibility for working with different S3-compatible services.The changes include:
S3UploadArgs
struct to include anendpoint
field.endpoint
if specified.endpoint
field is not provided.AmazonS3Builder
configuration to incorporate the custom endpoint.Testing
Case 1: Without
endpoint
fieldInput:
Expected: URL defaults to
https://example-bucket.s3.us-west-1.amazonaws.com/...
.Case 2: With
endpoint
fieldInput:
Expected: URL uses the custom endpoint
https://custom-s3-endpoint.com/...
.Checklist
endpoint
field toS3UploadArgs
.AmazonS3Builder
logic for custom endpoint.endpoint
field.Related Issues
References