Refactor configuration handling
Refactored `MessagingServiceApplicationConfiguration` to simplify the tracking of the LuckyPennySoft license key configuration by replacing the `_configured` tuple with a boolean. Removed email account configuration methods from this class. Updated `MessagingServiceInfrastructureConfiguration` to introduce a new `_configured` tuple for tracking `RabbitMqConnectionFactory` and `EmailAccounts` configurations. Added methods for configuring email accounts and updated the `EnsureRabbitMqConnectionFactoryAdded` method to include email account checks. Changed the namespace of `EmailAccountsOptions.cs` to `DigitalData.MessagingService.Infrastructure.Options`. Modified `Program.cs` to include email account configuration in the infrastructure setup. Added new files `DependencyInjectionExtensions.cs` and `MessagingServiceConfiguration.cs` as placeholders for future extensions, wrapped in `#if NET` directives. Removed an `<ItemGroup>` from `DigitalData.MessagingService.Infrastructure.csproj` and updated `DigitalData.MessagingService.Client.csproj` for XML compliance.
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
#if NET
|
||||
using DigitalData.MessagingService.Application.Common.Dto.EmailAccounts;
|
||||
|
||||
namespace DigitalData.MessagingService.Infrastructure.Options;
|
||||
|
||||
/// <summary>
|
||||
/// Wrapper options class that holds a list of <see cref="Dto.EmailAccount"/> entries
|
||||
/// bound from the <c>EmailAccounts</c> configuration section.
|
||||
/// </summary>
|
||||
public class EmailAccountsOptions
|
||||
{
|
||||
public const string SectionName = "EmailAccounts";
|
||||
|
||||
/// <summary>
|
||||
/// The list of configured email accounts.
|
||||
/// </summary>
|
||||
public required List<EmailAccountModificationDto> Accounts { get; set; } = [];
|
||||
|
||||
/// <summary>
|
||||
/// How often the IMAP sync worker polls for new emails, in seconds.
|
||||
/// Defaults to 300 seconds (5 minutes).
|
||||
/// </summary>
|
||||
public int SyncIntervalSeconds { get; set; } = 300;
|
||||
|
||||
/// <summary>
|
||||
/// The minimum interval, in seconds, between forced IMAP sync operations regardless of idle state.
|
||||
/// Defaults to 30 seconds (0.5 minute).
|
||||
/// </summary>
|
||||
public int ForcedSyncIntervalSeconds { get; set; } = 30;
|
||||
}
|
||||
#endif
|
||||
Reference in New Issue
Block a user