- 37개 파일 IP → zioinfo.co.kr 치환 (소스/매뉴얼/설정/하네스) - Manager DrConsole/NetworkConsole/CsapConsole 빌드 + /var/www/manager/ 배포 - 테스트: Manager HTTP 200, ITSM 신규 API 7개 전체 200 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
28 lines
1.1 KiB
Python
28 lines
1.1 KiB
Python
import httpx, os
|
|
from fastapi import APIRouter, Depends, HTTPException
|
|
from core.auth import verify_token
|
|
|
|
router = APIRouter()
|
|
WEBHOOK_URL = os.environ.get("DEPLOY_WEBHOOK", "http://localhost:9999/")
|
|
DEPLOY_LOG = os.environ.get("DEPLOY_LOG", "/var/log/zioinfo/deploy.log")
|
|
|
|
@router.post("/trigger/{repo}")
|
|
async def trigger(repo: str, user=Depends(verify_token)):
|
|
async with httpx.AsyncClient() as c:
|
|
try:
|
|
r = await c.post(WEBHOOK_URL,
|
|
json={"repo": repo, "triggered_by": user.get("sub", "manager")},
|
|
timeout=10)
|
|
return {"status": r.status_code, "message": f"{repo} 배포 트리거됨"}
|
|
except Exception as e:
|
|
raise HTTPException(status_code=502, detail=f"Deploy Webhook 연결 실패: {e}")
|
|
|
|
@router.get("/history")
|
|
async def history(_=Depends(verify_token)):
|
|
try:
|
|
with open(DEPLOY_LOG, encoding="utf-8", errors="replace") as f:
|
|
lines = f.readlines()[-200:]
|
|
return {"lines": [l.rstrip() for l in lines]}
|
|
except FileNotFoundError:
|
|
return {"lines": []}
|