🔊 Resume conf.json au demarrage (services configures visibles dans les logs)

This commit is contained in:
Orionis312050 committed 2026-10-11 21:27:26 +00:00
1 parent 514f417c15
commit 23132c6219
2 files changed
+34

No files matched your search

+21
View File
@@ -64,6 +64,7 @@ async def lifespan(_: FastAPI):
# Don't fail app startup for a best-effort migration. # Don't fail app startup for a best-effort migration.
pass pass
auth.bootstrap_setup() auth.bootstrap_setup()
_log_config_summary()
worker_task = asyncio.create_task(conversion_worker()) worker_task = asyncio.create_task(conversion_worker())
try: try:
yield yield
@@ -278,6 +279,26 @@ def get_file(file_id: int, db: DbSession) -> IsoMovie:
return item 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: def _poster_url(movie: dict) -> str | None:
for image in movie.get("images") or []: for image in movie.get("images") or []:
if image.get("coverType") == "poster": if image.get("coverType") == "poster":
+13
View File
@@ -186,3 +186,16 @@ def test_setup_link_only_without_existing_account() -> None:
json={"token": "peu-importe", "username": "autre", "password": "z"}, json={"token": "peu-importe", "username": "autre", "password": "z"},
) )
assert response.status_code == 403 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