24 lines
866 B
Markdown
24 lines
866 B
Markdown
# 配置文件说明
|
||
|
||
本目录存放应用所有 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 模型。
|