diff --git a/src/Server/src/Abstractions/Configuration/IdOpsServerOptions.cs b/src/Server/src/Abstractions/Configuration/IdOpsServerOptions.cs index 6208e82..ebeefcd 100644 --- a/src/Server/src/Abstractions/Configuration/IdOpsServerOptions.cs +++ b/src/Server/src/Abstractions/Configuration/IdOpsServerOptions.cs @@ -31,6 +31,15 @@ public class EventHubOptions public string? ConnectionString { get; set; } public string? Namespace { get; set; } + + public EventStorageHubOptions? Storage { get; set; } + } + + public sealed class EventStorageHubOptions + { + public string? ConnectionString { get; set; } + + public string? Url { get; set; } } public enum MessagingTransport diff --git a/src/Server/src/Core/Configuration/IdOpsServerBuilderExtensions.cs b/src/Server/src/Core/Configuration/IdOpsServerBuilderExtensions.cs index 9b13606..d2b44ed 100644 --- a/src/Server/src/Core/Configuration/IdOpsServerBuilderExtensions.cs +++ b/src/Server/src/Core/Configuration/IdOpsServerBuilderExtensions.cs @@ -186,6 +186,23 @@ private static void UseEventHub( } k.ReceiveEndpoint("identity-events", e => e.ConfigureConsumers(contex)); + + if (options.Storage is { } storageOption) + { + if (storageOption.Url is { } url) + { + k.Storage(new Uri(url), new DefaultAzureCredential()); + } + else if (storageOption.ConnectionString is { } connectionString) + { + k.Storage(connectionString); + } + else + { + throw new ApplicationException( + "EventHub storage configuration is missing. Please check your settings."); + } + } }); }); }