feat: FastAPI console with dashboard, Pulp client, healthz (stages 0-1)
- config: PULP_* env + 사내 CA(verify=) 대응 - pulp_client: Basic Auth get/post/patch, status/list_repos/get_version - BFF 라우트: GET / (대시보드), GET /repos (조각), GET /healthz - views: Pulp JSON → 표시 모델 (GPG 검증 배지 3단계, 요약 집계) - HTMX + Jinja 템플릿, vendored pico.css/htmx.js (CDN 의존 0) - 브라우저는 Pulp 직접 호출 안 함 — 모두 BFF 경유 (스펙 §2) - 테스트: pulp_client(respx), 라우트(dependency_overrides), views 순수함수 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
33
app/deps.py
Normal file
33
app/deps.py
Normal file
@@ -0,0 +1,33 @@
|
||||
"""공용 의존성: 템플릿 엔진, 요청 단위 Pulp 클라이언트.
|
||||
|
||||
라우터 모듈들이 main 을 import 하지 않도록 여기로 분리(순환참조 방지).
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Iterator
|
||||
from pathlib import Path
|
||||
|
||||
from fastapi.templating import Jinja2Templates
|
||||
|
||||
from .config import get_settings
|
||||
from .pulp_client import PulpClient
|
||||
|
||||
TEMPLATES_DIR = Path(__file__).resolve().parent / "templates"
|
||||
templates = Jinja2Templates(directory=str(TEMPLATES_DIR))
|
||||
|
||||
|
||||
def get_pulp_client() -> Iterator[PulpClient]:
|
||||
"""요청 단위 Pulp 클라이언트. 테스트에서 dependency_overrides 로 교체한다."""
|
||||
if get_settings().pulp_demo:
|
||||
# 임시 데모 모드: 가짜 데이터 (단계5 전 제거 가능)
|
||||
from .demo import DemoPulpClient
|
||||
|
||||
yield DemoPulpClient() # type: ignore[misc]
|
||||
return
|
||||
|
||||
pulp = PulpClient()
|
||||
try:
|
||||
yield pulp
|
||||
finally:
|
||||
pulp.close()
|
||||
Reference in New Issue
Block a user