Refactor config router to use explicit dependency injection

This commit is contained in:
2026-04-06 21:11:02 +02:00
parent ca4b0ed324
commit 0a70e40d8b
2 changed files with 71 additions and 54 deletions

View File

@@ -10,6 +10,8 @@ Reference: `Docs/Refactoring.md` for full analysis of each issue.
### Backend Architecture Review Findings
- Status: **done**`backend/app/routers/config.py` now uses explicit dependency injection for fail2ban settings and no longer reads `request.app.state.settings` directly.
- `backend/app/routers/*` often reads config directly from `request.app.state.settings` instead of using dependency injection. This bypasses the dependency layer and creates hidden coupling between routers and application state.
- Fix: replace direct `request.app.state.settings` access with `SettingsDep` or other explicit dependencies such as `ServerStatusDep` and `PendingRecoveryDep` in router function signatures.
- Expected outcome: routers become easier to unit test, composition is more explicit, and shared state access is only available through documented FastAPI dependencies.