feat: add configuration model and appsettings.json
This commit is contained in:
36
src/SpamGuard/Configuration/SpamGuardOptions.cs
Normal file
36
src/SpamGuard/Configuration/SpamGuardOptions.cs
Normal 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;
|
||||
}
|
||||
38
src/SpamGuard/appsettings.json
Normal file
38
src/SpamGuard/appsettings.json
Normal 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
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user