Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 2c9f5a846c | |||
| 89a343a85f |
@@ -5,13 +5,13 @@ namespace LiteCharms.Features.S3;
|
|||||||
public class BookstoreS3Service(IConfiguration configuration, [FromKeyedServices(Constants.BookshopBucketName)] IAmazonS3 amazonS3) :
|
public class BookstoreS3Service(IConfiguration configuration, [FromKeyedServices(Constants.BookshopBucketName)] IAmazonS3 amazonS3) :
|
||||||
S3ServiceBase(amazonS3), IS3Service
|
S3ServiceBase(amazonS3), IS3Service
|
||||||
{
|
{
|
||||||
|
private readonly string bucketName = configuration.GetSection($"{Constants.BookshopS3SettingsSection}:BucketName").Value ?? "";
|
||||||
|
private readonly string cdnBaseUrl = configuration.GetSection($"{Constants.BookshopS3SettingsSection}:CdnBaseUrl").Value ?? "";
|
||||||
|
|
||||||
public override async Task<Result<string>> UploadFileAsync(string fileName, Stream fileStream, string contentType, CancellationToken cancellationToken = default)
|
public override async Task<Result<string>> UploadFileAsync(string fileName, Stream fileStream, string contentType, CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var bucketName = configuration.GetSection($"{Constants.BookshopS3SettingsSection}:BucketName").Value!;
|
|
||||||
var cdnBaseUrl = configuration.GetSection($"{Constants.BookshopS3SettingsSection}:CdnBaseUrl").Value!;
|
|
||||||
|
|
||||||
if(string.IsNullOrWhiteSpace(bucketName))
|
if(string.IsNullOrWhiteSpace(bucketName))
|
||||||
return Result.Fail<string>("Bucket name is not configured.");
|
return Result.Fail<string>("Bucket name is not configured.");
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user