-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
62 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 2 additions & 18 deletions
20
src/BE/Services/FileServices/Implementations/Minio/MinioFileService.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,7 @@ | ||
using Amazon; | ||
using Amazon.S3; | ||
using Chats.BE.Services.FileServices.Implementations.AwsS3; | ||
using Chats.BE.Services.FileServices.Implementations.AwsS3; | ||
|
||
namespace Chats.BE.Services.FileServices.Implementations.Minio; | ||
|
||
public class MinioFileService(MinioConfig config) : AwsS3FileService(config, CreateS3(config)) | ||
public class MinioFileService(MinioConfig config) : AwsS3FileService(config.Bucket, config.CreateS3()) | ||
{ | ||
private static AmazonS3Client CreateS3(MinioConfig config) | ||
{ | ||
AmazonS3Config s3Config = new() | ||
{ | ||
ForcePathStyle = true, | ||
ServiceURL = config.Endpoint, | ||
}; | ||
if (config.Region != null) | ||
{ | ||
s3Config.RegionEndpoint = RegionEndpoint.GetBySystemName(config.Region); | ||
} | ||
AmazonS3Client s3 = new(config.AccessKey, config.SecretKey, s3Config); | ||
return s3; | ||
} | ||
} |