log
2026-06-25 b72261d9784a4407cb5dddee6222d181dbb3e968
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
from typing import Any, Dict
 
from fastapi import APIRouter, Response
from pydantic import BaseModel, Field
 
from api.logging_config import apply_access_log_setting, apply_log_level_setting
from config import Config, CONFIG_PATH
 
router = APIRouter(tags=["Configuration"])
 
 
class ConfigUpdateRequest(BaseModel):
    values: Dict[str, Any] = Field(default_factory=dict)
 
 
@router.get("/api/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,
        "path": str(CONFIG_PATH),
    }