🔊 Resume conf.json au demarrage (services configures visibles dans les logs)
This commit is contained in:
1 parent
514f417c15
commit
f1cf5ca661
2 files changed
+34
No files matched your search
+21
@@ -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":
|
||||
|
||||
@@ -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
|
||||
Reference in new issue
Block a user