From 8a99fc0505c140ffd87355197a12d786b30f0478 Mon Sep 17 00:00:00 2001 From: Andrew Camilleri Date: Thu, 2 May 2019 13:39:13 +0200 Subject: [PATCH] Fix Azure Storage (#803) --- .../Configuration/AzureBlobStorageConfiguration.cs | 5 ++--- .../AzureBlobStorageConfigurationMetadata.cs | 11 +++++++++++ 2 files changed, 13 insertions(+), 3 deletions(-) create mode 100644 BTCPayServer/Storage/Services/Providers/AzureBlobStorage/Configuration/AzureBlobStorageConfigurationMetadata.cs diff --git a/BTCPayServer/Storage/Services/Providers/AzureBlobStorage/Configuration/AzureBlobStorageConfiguration.cs b/BTCPayServer/Storage/Services/Providers/AzureBlobStorage/Configuration/AzureBlobStorageConfiguration.cs index 931e640a2..72cc828ae 100644 --- a/BTCPayServer/Storage/Services/Providers/AzureBlobStorage/Configuration/AzureBlobStorageConfiguration.cs +++ b/BTCPayServer/Storage/Services/Providers/AzureBlobStorage/Configuration/AzureBlobStorageConfiguration.cs @@ -1,9 +1,11 @@ using System.ComponentModel.DataAnnotations; using BTCPayServer.Storage.Services.Providers.Models; +using Microsoft.AspNetCore.Mvc; using TwentyTwenty.Storage.Azure; namespace BTCPayServer.Storage.Services.Providers.AzureBlobStorage.Configuration { + [ModelMetadataType(typeof(AzureBlobStorageConfigurationMetadata))] public class AzureBlobStorageConfiguration : AzureProviderOptions, IBaseStorageConfiguration { [Required] @@ -12,8 +14,5 @@ namespace BTCPayServer.Storage.Services.Providers.AzureBlobStorage.Configuration [RegularExpression(@"[a-z0-9-]+", ErrorMessage = "Characters must be lowercase or digits or -")] public string ContainerName { get; set; } - - [Required][AzureBlobStorageConnectionStringValidator] - public new string ConnectionString { get; set; } } } diff --git a/BTCPayServer/Storage/Services/Providers/AzureBlobStorage/Configuration/AzureBlobStorageConfigurationMetadata.cs b/BTCPayServer/Storage/Services/Providers/AzureBlobStorage/Configuration/AzureBlobStorageConfigurationMetadata.cs new file mode 100644 index 000000000..a16165488 --- /dev/null +++ b/BTCPayServer/Storage/Services/Providers/AzureBlobStorage/Configuration/AzureBlobStorageConfigurationMetadata.cs @@ -0,0 +1,11 @@ +using System.ComponentModel.DataAnnotations; + +namespace BTCPayServer.Storage.Services.Providers.AzureBlobStorage.Configuration +{ + public class AzureBlobStorageConfigurationMetadata + { + [Required] + [AzureBlobStorageConnectionStringValidator] + public string ConnectionString { get; set; } + } +}