Files
chongming-config/README.md
T
2026-07-22 17:15:16 +08:00

24 lines
866 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 配置文件说明
本目录存放应用所有 TOML 配置文件。
## 主要文件
- `config.toml`:应用主配置(环境、服务器、日志、安全、缓存等)
- `zenoh_config.json5`:Zenoh 会话配置(JSON5 格式)
- `workers/config.toml`:Worker 插件加载列表(指定模块、工厂函数、副本数)
- `workers/<worker_type>/*.toml`:每个 Worker 的路由定义(如 `add.toml`, `divide.toml`)
## Worker 路由配置格式
每个接口文件(如 `add.toml`)包含 HTTP 方法节(`[GET]`, `[POST]` 等):
```toml
[GET]
summary = "Add two numbers"
params = ["a: float", "b: float"]
response_model = { result = { type = "float", required = true }, operation = { type = "str", default = "add" } }
```
执行 `uv run gen_models config/workers/example src/plugins/example` 可自动生成对应的 Pydantic 模型。