Refactor: Server-Settings von appsettings.json in DB-Tabelle (server_settings)
- Neuer ServerSettingsService: zentrale Settings in SQLite mit In-Memory-Cache - Auto-Migration: bestehende appsettings.Production.json wird einmalig in DB übernommen - Alle Services umgestellt: IConfiguration → ServerSettingsService (dynamisch, kein Neustart) - Port bleibt als einziges Setting in appsettings.Production.json (erfordert Neustart) - ServerSettingsEndpoint: liest/schreibt DB statt JSON-Datei, Port als Sonder-Setting - IConfiguration komplett entfernt aus allen Services (ChatService, ToolService, AnthropicService, OpenAiService, KreaService, TelegramService, KeyScannerService, GitHubEventScannerService) - AuthMiddleware: KreaApiKey dynamisch aus DB - appsettings.json bereinigt: nur noch Port und Logging - Dokumentation aktualisiert (ARCHITECTURE.md, ARCHITECTURE_QUICK.md, README.md)
This commit is contained in:
1 parent
542a031172
commit
122000487c
18 files changed
+389
-270
No files matched your search
@@ -14,9 +14,11 @@ namespace Gott.Services
|
||||
public class KreaService
|
||||
{
|
||||
private readonly IHttpClientFactory _httpFactory;
|
||||
private readonly string _token;
|
||||
private readonly ServerSettingsService _settings;
|
||||
private readonly string _imagesDir;
|
||||
|
||||
private string _token => _settings.Get("KreaToken");
|
||||
|
||||
private const string BASE_URL = "https://api.krea.ai";
|
||||
|
||||
public static readonly Dictionary<string, string> IMAGE_MODELS = new Dictionary<string, string>
|
||||
@@ -47,10 +49,10 @@ namespace Gott.Services
|
||||
|
||||
public bool IsConfigured => !string.IsNullOrWhiteSpace(_token);
|
||||
|
||||
public KreaService(IHttpClientFactory httpFactory, string token, string dataDir)
|
||||
public KreaService(IHttpClientFactory httpFactory, ServerSettingsService settings, string dataDir)
|
||||
{
|
||||
_httpFactory = httpFactory;
|
||||
_token = token;
|
||||
_settings = settings;
|
||||
_imagesDir = Path.Combine(dataDir, "images");
|
||||
Directory.CreateDirectory(_imagesDir);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user