27 lines
813 B
Python
27 lines
813 B
Python
"""Endpoints that stay reachable without a token.
|
|
|
|
`bin/wait-deploy` polls /api/version from whatever machine you pushed from, so
|
|
requiring the token here would mean carrying it around just to answer "is my
|
|
commit live yet". Neither endpoint exposes anything about the market data or
|
|
the configuration.
|
|
"""
|
|
import os
|
|
from datetime import datetime, timezone
|
|
|
|
from fastapi import APIRouter
|
|
|
|
router = APIRouter(prefix="/api")
|
|
|
|
# Coolify injects the deployed commit; absent when running locally.
|
|
SOURCE_COMMIT = os.environ.get("SOURCE_COMMIT", "dev")
|
|
STARTED_AT = datetime.now(timezone.utc).replace(microsecond=0).isoformat()
|
|
|
|
|
|
@router.get("/health")
|
|
def health():
|
|
return {"status": "ok", "service": "chart"}
|
|
|
|
|
|
@router.get("/version")
|
|
def version():
|
|
return {"commit": SOURCE_COMMIT, "started_at": STARTED_AT}
|