Centralize fail2ban metadata resolution and cache DB path discovery

This commit is contained in:
2026-04-12 19:48:33 +02:00
parent e221cd414f
commit 72488b14b2
4 changed files with 189 additions and 18 deletions

View File

@@ -114,6 +114,7 @@ Reference: `Docs/Refactoring.md` for full analysis of each issue.
- Issue: `app/utils/fail2ban_db_utils.get_fail2ban_db_path` queries fail2ban for the database path on every history request. This ties read-only history endpoints to socket availability and duplicates discovery logic across the codebase.
- Propose: Introduce a dedicated fail2ban metadata service that resolves and caches runtime metadata such as the fail2ban DB path, refreshing it only when needed instead of every request.
- Test: Add tests that confirm history requests can reuse cached metadata, and that the metadata service falls back cleanly when the socket is temporarily unavailable after initial resolution.
- Status: completed
16. Introduce an explicit application lifecycle context to replace raw `app.state` access
- Goal: Make shared infrastructure handles and runtime configuration available through a typed, injectable context instead of a loosely-typed `app.state` bag.