From 09ff4d98d6c6486b7c62fdbc1a6cdabbb4e902b9 Mon Sep 17 00:00:00 2001 From: Nikola Vetnic Date: Mon, 24 Jun 2024 22:56:16 +0200 Subject: [PATCH] fix: wip --- .../BlobStorageServiceCollectionExtensions.cs | 16 ++++++++-------- .../Files/src/Files.ConsumerApi/Configuration.cs | 15 +++++++++++---- .../Extensions/IConfigurationExtensions.cs | 15 +++++++++++---- 3 files changed, 30 insertions(+), 16 deletions(-) diff --git a/BuildingBlocks/src/BuildingBlocks.Infrastructure/Persistence/BlobStorage/BlobStorageServiceCollectionExtensions.cs b/BuildingBlocks/src/BuildingBlocks.Infrastructure/Persistence/BlobStorage/BlobStorageServiceCollectionExtensions.cs index 321b266438..7908f86aa5 100644 --- a/BuildingBlocks/src/BuildingBlocks.Infrastructure/Persistence/BlobStorage/BlobStorageServiceCollectionExtensions.cs +++ b/BuildingBlocks/src/BuildingBlocks.Infrastructure/Persistence/BlobStorage/BlobStorageServiceCollectionExtensions.cs @@ -39,10 +39,10 @@ public static void AddBlobStorage(this IServiceCollection services, BlobStorageO { services.Configure(opt => { - opt.ServiceUrl = options.IonosS3Config!.ServiceUrl!; - opt.AccessKey = options.IonosS3Config!.AccessKey!; - opt.SecretKey = options.IonosS3Config!.SecretKey!; - opt.BucketName = options.IonosS3Config!.BucketName!; + opt.ServiceUrl = options.IonosS3Config!.ServiceUrl; + opt.AccessKey = options.IonosS3Config!.AccessKey; + opt.SecretKey = options.IonosS3Config!.SecretKey; + opt.BucketName = options.IonosS3Config!.BucketName; }); services.AddSingleton(); @@ -71,9 +71,9 @@ public class BlobStorageOptions public class IonosS3Config { - public string? ServiceUrl { get; set; } - public string? AccessKey { get; set; } - public string? SecretKey { get; set; } - public string? BucketName { get; set; } + public required string ServiceUrl { get; set; } = string.Empty; + public required string AccessKey { get; set; } = string.Empty; + public required string SecretKey { get; set; } = string.Empty; + public required string BucketName { get; set; } = string.Empty; } diff --git a/Modules/Files/src/Files.ConsumerApi/Configuration.cs b/Modules/Files/src/Files.ConsumerApi/Configuration.cs index d448a59255..0d1b3f038b 100644 --- a/Modules/Files/src/Files.ConsumerApi/Configuration.cs +++ b/Modules/Files/src/Files.ConsumerApi/Configuration.cs @@ -47,10 +47,17 @@ public class SqlDatabaseConfiguration public class IonosS3Config { - public string? ServiceUrl { get; set; } - public string? AccessKey { get; set; } - public string? SecretKey { get; set; } - public string? BucketName { get; set; } + [Required] + public string ServiceUrl { get; set; } = string.Empty; + + [Required] + public string AccessKey { get; set; } = string.Empty; + + [Required] + public string SecretKey { get; set; } = string.Empty; + + [Required] + public string BucketName { get; set; } = string.Empty; } } } diff --git a/Modules/Files/src/Files.Jobs.SanityCheck/Extensions/IConfigurationExtensions.cs b/Modules/Files/src/Files.Jobs.SanityCheck/Extensions/IConfigurationExtensions.cs index e00e42d3ef..85719dd083 100644 --- a/Modules/Files/src/Files.Jobs.SanityCheck/Extensions/IConfigurationExtensions.cs +++ b/Modules/Files/src/Files.Jobs.SanityCheck/Extensions/IConfigurationExtensions.cs @@ -43,8 +43,15 @@ public class BlobStorageConfiguration public class IonosS3Config { - public string? ServiceUrl { get; set; } - public string? AccessKey { get; set; } - public string? SecretKey { get; set; } - public string? BucketName { get; set; } + [Required] + public string ServiceUrl { get; set; } = string.Empty; + + [Required] + public string AccessKey { get; set; } = string.Empty; + + [Required] + public string SecretKey { get; set; } = string.Empty; + + [Required] + public string BucketName { get; set; } = string.Empty; }