88bdf6f34b
- Split monolithic app.py into server/api/ routers - Add Pydantic schemas for input validation - Add /agent/* API with separate AGENT_TOKEN auth - Replace static schema.sql with versioned migrations (datenerhaltend) - Add tools/backup_db.py for SQLite backups - Add Dockerfile HEALTHCHECK and compose.yml AGENT_TOKEN env - Add pytest tests for user and agent API - Update README with API docs and deployment safety notes - Bump version to 1.2.0
26 lines
711 B
Python
26 lines
711 B
Python
from __future__ import annotations
|
|
|
|
from fastapi import APIRouter, Depends
|
|
from fastapi.responses import JSONResponse
|
|
|
|
from server.auth import require_auth
|
|
from server.config_loader import load_meds_config, slot_to_dict
|
|
from server.settings import settings
|
|
|
|
router = APIRouter(prefix="/api/config", tags=["config"])
|
|
|
|
NO_STORE = {"Cache-Control": "no-store"}
|
|
|
|
|
|
@router.get("/")
|
|
async def get_config(_: dict = Depends(require_auth)) -> JSONResponse:
|
|
config = load_meds_config()
|
|
return JSONResponse(
|
|
{
|
|
"timezone": str(config.timezone),
|
|
"slots": [slot_to_dict(s) for s in config.slots],
|
|
"version": settings.app_version,
|
|
},
|
|
headers=NO_STORE,
|
|
)
|