feat: add configuration model and appsettings.json

This commit is contained in:
2026-04-07 11:38:07 +01:00
parent ad87e1c2c5
commit 0ee0a43b6a
2 changed files with 74 additions and 0 deletions

View File

@@ -0,0 +1,36 @@
namespace SpamGuard.Configuration;
public sealed class SpamGuardOptions
{
public const string SectionName = "SpamGuard";
public ImapOptions Imap { get; set; } = new();
public ClaudeOptions Claude { get; set; } = new();
public MonitoringOptions Monitoring { get; set; } = new();
}
public sealed class ImapOptions
{
public string Host { get; set; } = "";
public int Port { get; set; } = 993;
public bool UseSsl { get; set; } = true;
public string Username { get; set; } = "";
public string Password { get; set; } = "";
}
public sealed class ClaudeOptions
{
public string ApiKey { get; set; } = "";
public string Model { get; set; } = "claude-sonnet-4-6";
public int MaxBodyLength { get; set; } = 2000;
}
public sealed class MonitoringOptions
{
public int PollIntervalSeconds { get; set; } = 60;
public int TrustedSenderRefreshMinutes { get; set; } = 60;
public double SpamConfidenceThreshold { get; set; } = 0.7;
public string SpamFolderName { get; set; } = "Junk";
public int InitialScanDays { get; set; } = 7;
public int MaxActivityLogEntries { get; set; } = 500;
}

View File

@@ -0,0 +1,38 @@
{
"SpamGuard": {
"Imap": {
"Host": "imap.example.com",
"Port": 993,
"UseSsl": true,
"Username": "user@example.com",
"Password": ""
},
"Claude": {
"ApiKey": "",
"Model": "claude-sonnet-4-6",
"MaxBodyLength": 2000
},
"Monitoring": {
"PollIntervalSeconds": 60,
"TrustedSenderRefreshMinutes": 60,
"SpamConfidenceThreshold": 0.7,
"SpamFolderName": "Junk",
"InitialScanDays": 7,
"MaxActivityLogEntries": 500
}
},
"Serilog": {
"MinimumLevel": "Information",
"WriteTo": [
{ "Name": "Console" },
{
"Name": "File",
"Args": {
"path": "%APPDATA%/SpamGuard/logs/spamguard-.log",
"rollingInterval": "Day",
"retainedFileCountLimit": 7
}
}
]
}
}