Add conditional EnvelopeFinalizationWorker service

Introduce a configuration-based mechanism to enable or disable
the `EnvelopeFinalizationWorker` hosted service.

- Updated `Program.cs` to conditionally register the service
  based on the `BackgroundServices:EnableEnvelopeFinalizationWorker`
  configuration setting.
- Added `BackgroundServices` section to `appsettings.json`
  with the worker disabled by default.
- Added `BackgroundServices` section to `appsettings.Development.json`
  with the worker enabled in the development environment.
This commit is contained in:
2026-11-27 11:22:35 +01:00
parent f66a8c374b
commit 58d7d34562
3 changed files with 12 additions and 1 deletions

View File

@@ -423,7 +423,12 @@ try
builder.Services.AddScoped<IEnvelopeAuthService, EnvelopeAuthService>(); builder.Services.AddScoped<IEnvelopeAuthService, EnvelopeAuthService>();
builder.Services.AddScoped<EnvelopeReceiverAuthorizationService>(); builder.Services.AddScoped<EnvelopeReceiverAuthorizationService>();
builder.Services.AddScoped<EnvelopeReceiverPageDataService>(); builder.Services.AddScoped<EnvelopeReceiverPageDataService>();
builder.Services.AddHostedService<EnvelopeFinalizationWorker>();
var enableEnvelopeFinalizationWorker = config.GetValue("BackgroundServices:EnableEnvelopeFinalizationWorker", false);
if (enableEnvelopeFinalizationWorker)
{
builder.Services.AddHostedService<EnvelopeFinalizationWorker>();
}
// DevExpress Server-Side Services (CRITICAL for DxPdfViewer) // DevExpress Server-Side Services (CRITICAL for DxPdfViewer)
builder.Services.AddDevExpressBlazor(); builder.Services.AddDevExpressBlazor();

View File

@@ -1,4 +1,7 @@
{ {
"BackgroundServices": {
"EnableEnvelopeFinalizationWorker": true
},
"Logging": { "Logging": {
"LogLevel": { "LogLevel": {
"Default": "Information", "Default": "Information",

View File

@@ -2,6 +2,9 @@
"UseSwagger": true, "UseSwagger": true,
"UseScalar": true, "UseScalar": true,
"UseDbMigration": false, "UseDbMigration": false,
"BackgroundServices": {
"EnableEnvelopeFinalizationWorker": false
},
"DevEndpoints": { "DevEndpoints": {
"EnableSignatureInkInProduction": false "EnableSignatureInkInProduction": false
}, },