feat(packs-lab): 4 라우트 — sign-link, upload, list, delete (HMAC + supabase)
This commit is contained in:
36
packs-lab/app/main.py
Normal file
36
packs-lab/app/main.py
Normal file
@@ -0,0 +1,36 @@
|
||||
"""packs-lab FastAPI application.
|
||||
|
||||
NAS 자료 다운로드 자동화 — DSM 공유 링크 발급 + 5GB 멀티파트 업로드 수신.
|
||||
모든 Vercel 호출은 HMAC 인증. 사용자 다운로드는 Vercel이 supabase 인증 후 프록시.
|
||||
"""
|
||||
import logging
|
||||
import os
|
||||
from contextlib import asynccontextmanager
|
||||
|
||||
from fastapi import FastAPI
|
||||
|
||||
logging.basicConfig(level=logging.INFO, format="%(asctime)s [%(name)s] %(levelname)s %(message)s")
|
||||
logger = logging.getLogger("packs-lab")
|
||||
|
||||
|
||||
@asynccontextmanager
|
||||
async def lifespan(app: FastAPI):
|
||||
# DSM credentials presence check
|
||||
for key in ("DSM_HOST", "DSM_USER", "DSM_PASS", "BACKEND_HMAC_SECRET"):
|
||||
if not os.getenv(key):
|
||||
logger.warning("환경변수 %s 미설정 — packs-lab 일부 기능 작동 안 함", key)
|
||||
logger.info("packs-lab 시작")
|
||||
yield
|
||||
|
||||
|
||||
app = FastAPI(lifespan=lifespan, title="packs-lab", version="1.0.0")
|
||||
|
||||
|
||||
@app.get("/health")
|
||||
def health():
|
||||
return {"status": "ok", "service": "packs-lab"}
|
||||
|
||||
|
||||
from . import routes # noqa: E402
|
||||
|
||||
app.include_router(routes.router)
|
||||
Reference in New Issue
Block a user