From 23132c621923d8b4e7cf7ae1991901aed3a1c08c Mon Sep 17 00:00:00 2001 From: Orionis312050 Date: Sun, 11 Oct 2026 21:27:26 +0000 Subject: [PATCH] :loud_sound: Resume conf.json au demarrage (services configures visibles dans les logs) --- app/main.py | 21 +++++++++++++++++++++ tests/test_api.py | 13 +++++++++++++ 2 files changed, 34 insertions(+) diff --git a/app/main.py b/app/main.py index 4e4ae28..db54c62 100644 --- a/app/main.py +++ b/app/main.py @@ -64,6 +64,7 @@ async def lifespan(_: FastAPI): # Don't fail app startup for a best-effort migration. pass auth.bootstrap_setup() + _log_config_summary() worker_task = asyncio.create_task(conversion_worker()) try: yield @@ -278,6 +279,26 @@ def get_file(file_id: int, db: DbSession) -> IsoMovie: return item +def _log_config_summary() -> None: + """Rend visible au lancement le chargement de conf.json.""" + cfg = read_config() + configured = [ + name + for name in ("radarr", "sonarr", "prowlarr", "jellyfin", "seerr") + if getattr(cfg, name).url + ] + if cfg.qbittorrent.url: + mode = "identifiants" if cfg.qbittorrent.username else "bypass d'authentification" + configured.append(f"qbittorrent ({mode})") + if configured: + print(f"conf.json charge: {', '.join(configured)}", flush=True) + else: + print( + "conf.json: aucune connexion configuree — a renseigner dans la page Configuration.", + flush=True, + ) + + def _poster_url(movie: dict) -> str | None: for image in movie.get("images") or []: if image.get("coverType") == "poster": diff --git a/tests/test_api.py b/tests/test_api.py index 0e3f2f0..c652408 100644 --- a/tests/test_api.py +++ b/tests/test_api.py @@ -186,3 +186,16 @@ def test_setup_link_only_without_existing_account() -> None: json={"token": "peu-importe", "username": "autre", "password": "z"}, ) assert response.status_code == 403 + + +def test_startup_logs_conf_json_summary(capsys) -> None: + """Au lancement, le log indique si conf.json est charge et ce qu'il contient.""" + with TestClient(app) as client: + client.put( + "/api/settings/qbittorrent", + json={"url": "192.168.1.50", "port": 8555}, + ) + with TestClient(app): + captured = capsys.readouterr() + assert "conf.json charge" in captured.out + assert "qbittorrent (bypass d'authentification)" in captured.out