Integrate Serilog and add configuration classes

Enhanced logging with Serilog, including request logging and
structured exception handling during startup. Added support
for the Options Pattern with new configuration classes:
`DocumentOperatorSettings`, `RedisSettings`, and
`ApiKeySettings`. Introduced `TenantInfo` class for tenant
management. Updated project files to include new dependencies
and removed unused `Configuration` folder reference.
This commit is contained in:
OlgunR
2026-06-16 11:21:03 +02:00
parent 87d7262d0a
commit d8f3143c8a
7 changed files with 106 additions and 20 deletions

View File

@@ -0,0 +1,9 @@
namespace DocumentOperator.Infrastructure.Configuration;
public class ApiKeySettings
{
public const string SectionName = "ApiKeySettings";
public bool EnableValidation { get; set; } = true;
public Dictionary<string, TenantInfo> Keys { get; set; } = new();
}

View File

@@ -0,0 +1,11 @@
namespace DocumentOperator.Infrastructure.Configuration;
public class DocumentOperatorSettings
{
public const string SectionName = "DocumentOperatorSettings";
public string TempFolderPath { get; set; } = string.Empty;
public int TempFileRetentionHours { get; set; }
public int MaxPdfSizeMB { get; set; }
public bool EnableDetailedLogging { get; set; }
}

View File

@@ -0,0 +1,10 @@
namespace DocumentOperator.Infrastructure.Configuration;
public class RedisSettings
{
public const string SectionName = "RedisSettings";
public string ConnectionString { get; set; } = "localhost:6379";
public string InstanceName { get; set; } = "DocumentOperator:";
public int CacheExpirationMinutes { get; set; } = 60;
}

View File

@@ -0,0 +1,8 @@
namespace DocumentOperator.Infrastructure.Configuration;
public class TenantInfo
{
public string TenantId { get; set; } = string.Empty;
public string TenantName { get; set; } = string.Empty;
public bool IsActive { get; set; } = true;
}

View File

@@ -17,7 +17,6 @@
</ItemGroup>
<ItemGroup>
<Folder Include="Configuration\" />
<Folder Include="DependencyInjection\" />
<Folder Include="Services\FileStorage\" />
<Folder Include="Services\DocumentValidation\" />