| | |
| | | from typing import Any, Dict |
| | | |
| | | from fastapi import APIRouter |
| | | from fastapi import APIRouter, Response |
| | | from pydantic import BaseModel, Field |
| | | |
| | | from api.logging_config import apply_access_log_setting |
| | | from api.logging_config import apply_access_log_setting, apply_log_level_setting |
| | | from config import Config, CONFIG_PATH |
| | | |
| | | router = APIRouter(tags=["Configuration"]) |
| | |
| | | |
| | | |
| | | @router.get("/api/config") |
| | | async def get_config(): |
| | | async def get_config(response: Response): |
| | | response.headers["Cache-Control"] = "no-cache, no-store, must-revalidate" |
| | | return { |
| | | "config": Config.as_dict(), |
| | | "path": str(CONFIG_PATH), |
| | |
| | | @router.put("/api/config") |
| | | async def update_config(req: ConfigUpdateRequest): |
| | | config = Config.update_config(req.values) |
| | | apply_log_level_setting() |
| | | apply_access_log_setting() |
| | | return { |
| | | "config": config, |