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