Files
EnvelopeGenerator/EnvelopeGenerator.Server/EnvelopeGenerator.Server/Options/BackgroundServicesOptions.cs
TekH 6657b6b15a Add remote trigger support for finalization worker
Introduced `RemoteEnvelopeFinalizationTrigger` to enable triggering the envelope finalization worker via a remote HTTP endpoint. Added `BackgroundServicesOptions` for centralized configuration of background services, including enabling/disabling the local worker and configuring the remote trigger URL.

Enhanced `TriggerFinalizationWorkerBehavior` with improved error handling and logging using `ILogger`. Added `DisableControllerConvention` to dynamically exclude controllers based on configuration.

Updated `Program.cs` for conditional service registration and improved configuration loading. Modified `appsettings.json` and `appsettings.Development.json` to include remote trigger settings. Incremented project version to `2.1.0-beta`.

Refactored code for better maintainability, scalability, and observability.
2026-11-27 13:33:40 +01:00

39 lines
1.2 KiB
C#

namespace EnvelopeGenerator.Server.Options;
/// <summary>
/// Configuration options for background service behavior.
/// </summary>
public sealed class BackgroundServicesOptions
{
/// <summary>
/// Configuration section name in appsettings.json.
/// </summary>
public const string SectionName = "BackgroundServices";
/// <summary>
/// Enables local hosted envelope finalization worker.
/// </summary>
public bool EnableEnvelopeFinalizationWorker { get; set; }
/// <summary>
/// Remote trigger endpoint configuration used when local worker is disabled.
/// </summary>
public RemoteEnvelopeFinalizationTriggerOptions RemoteEnvelopeFinalizationTrigger { get; set; } = new();
}
/// <summary>
/// Configuration options for remote envelope finalization trigger endpoint.
/// </summary>
public sealed class RemoteEnvelopeFinalizationTriggerOptions
{
/// <summary>
/// Named HttpClient key for remote trigger calls.
/// </summary>
public const string HttpClientName = "EnvelopeFinalizationRemoteTrigger";
/// <summary>
/// Absolute trigger URL (for example: https://host/api/BackgroundServices/envelope-finalization-worker/trigger).
/// </summary>
public string? Url { get; set; }
}