-
Notifications
You must be signed in to change notification settings - Fork 773
Add support for MiniO storage backend #667
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -22,13 +22,36 @@ Update the `appsettings.json` file: | |||||||
| "Region": "us-west-1", | ||||||||
| "Bucket": "foo", | ||||||||
| "AccessKey": "", | ||||||||
| "SecretKey": "" | ||||||||
| "SecretKey": "", | ||||||||
| "ServiceUrl": "", | ||||||||
| "UseHttp": false, | ||||||||
| "ForcePathStyle": false | ||||||||
|
Comment on lines
+26
to
+28
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It'd be less confusing to folks if we separate the AWS S3 and MinIO samples:
Suggested change
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sound good |
||||||||
| }, | ||||||||
|
|
||||||||
| ... | ||||||||
| } | ||||||||
| ``` | ||||||||
|
|
||||||||
| To use MinIO as an S3 compatible storage backend, provide the MinIO installation URL in `ServiceUrl` and set `ForcePathStyle` to `true`: | ||||||||
|
|
||||||||
| ```json | ||||||||
| { | ||||||||
| ... | ||||||||
|
|
||||||||
| "Storage": { | ||||||||
| "Type": "AwsS3", | ||||||||
| "Region": "us-west-1", | ||||||||
| "Bucket": "foo", | ||||||||
| "AccessKey": "", | ||||||||
| "SecretKey": "", | ||||||||
| "ServiceUrl": "", | ||||||||
| "ForcePathStyle": false, | ||||||||
| "UseHttp": false | ||||||||
| }, | ||||||||
|
|
||||||||
| ... | ||||||||
| } | ||||||||
|
|
||||||||
| ### Amazon RDS | ||||||||
|
|
||||||||
| To use PostgreSQL, update the `appsettings.json` file: | ||||||||
|
|
||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -31,11 +31,24 @@ public static BaGetApplication AddAwsS3Storage(this BaGetApplication app) | |||||||||||
| { | ||||||||||||
| var options = provider.GetRequiredService<IOptions<S3StorageOptions>>().Value; | ||||||||||||
|
|
||||||||||||
| if (options.ForcePathStyle) | ||||||||||||
| { | ||||||||||||
| // Required to support presigned urls generation for MiniO configured to us-east-1 region | ||||||||||||
| AWSConfigsS3.UseSignatureVersion4 = true; | ||||||||||||
| } | ||||||||||||
|
|
||||||||||||
| var config = new AmazonS3Config | ||||||||||||
| { | ||||||||||||
| RegionEndpoint = RegionEndpoint.GetBySystemName(options.Region) | ||||||||||||
| RegionEndpoint = RegionEndpoint.GetBySystemName(options.Region), | ||||||||||||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. From my understanding the region can be set using the service URL. If so should we follow @DTeuchert's pattern in #272:
Suggested change
This will let us delete lines 47-50 below: - if (!string.IsNullOrWhiteSpace(options.ServiceUrl))
- {
- config.ServiceURL = options.ServiceUrl;
- }
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the AWS SDK requires a region independent from service url, but im not fully sure. |
||||||||||||
| ForcePathStyle = options.ForcePathStyle, | ||||||||||||
| UseHttp = options.UseHttp | ||||||||||||
| }; | ||||||||||||
|
|
||||||||||||
| if (!string.IsNullOrWhiteSpace(options.ServiceUrl)) | ||||||||||||
| { | ||||||||||||
| config.ServiceURL = options.ServiceUrl; | ||||||||||||
| } | ||||||||||||
|
|
||||||||||||
| if (options.UseInstanceProfile) | ||||||||||||
| { | ||||||||||||
| var credentials = FallbackCredentialsFactory.GetCredentials(); | ||||||||||||
|
|
||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -22,5 +22,11 @@ public class S3StorageOptions | |
| public bool UseInstanceProfile { get; set; } | ||
|
|
||
| public string AssumeRoleArn { get; set; } | ||
|
|
||
| public bool ForcePathStyle { get; set; } | ||
|
|
||
| public string ServiceUrl { get; set; } | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could we add the data annotation attributes that @DTeuchert had used in #272? - [Required]
+ [RequiredIf(nameof(ServiceUrl), null)]
public string Region { get; set; }
+ [RequiredIf(nameof(Region), null)]
public string ServiceUrl { get; set; }There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes in my understanding we need a service url for a private / on premise solutions or a region. |
||
|
|
||
| public bool UseHttp { get; set; } | ||
| } | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.