36 lines
1.2 KiB
Python
36 lines
1.2 KiB
Python
"""公开只读配置接口(前端运行时读取 config.yaml 派生值)。
|
||
|
||
目前只暴露 ``task_deeplink`` 段(任务深链 rwfx 的目的树闸门地址 + 测试开关 +
|
||
测试假数据),供前端登录深链流程在运行时读取——无需把这些地址硬编码进前端,
|
||
改 ``config.yaml`` 即时生效(Gateway mtime 热重载)。
|
||
|
||
**无鉴权**:路由挂在 ``/api/public/`` 前缀下,已被
|
||
``auth_middleware._PUBLIC_PATH_PREFIXES`` 白名单放行。段内只有地址与开关,不含密钥。
|
||
"""
|
||
|
||
from __future__ import annotations
|
||
|
||
import logging
|
||
|
||
from fastapi import APIRouter
|
||
|
||
from deerflow.config import get_app_config
|
||
|
||
logger = logging.getLogger(__name__)
|
||
|
||
router = APIRouter(prefix="/api/public/config", tags=["public-config"])
|
||
|
||
|
||
@router.get("/task-deeplink")
|
||
async def get_task_deeplink_config() -> dict:
|
||
"""返回 ``config.yaml`` 的 ``task_deeplink`` 段(含 test/delete_test/各 URL/mock)。"""
|
||
config = get_app_config()
|
||
return config.task_deeplink.model_dump()
|
||
|
||
|
||
@router.get("/y-log")
|
||
async def get_y_log_config() -> dict:
|
||
"""返回 ``config.yaml`` 的 ``y_log`` 段(enabled / write_url),无密钥,公开只读。"""
|
||
config = get_app_config()
|
||
return config.y_log.model_dump()
|