- 新增 src/server/config/ 模块(types、issues、variables、normalizer、schema)
- 配置布局从 server.host/server.port 切换为 server.listen.host/server.listen.port
- 移除 HOST/PORT 隐式环境变量覆盖,改为 YAML 显式 ${KEY} 变量引用
- 支持 ${KEY}、${KEY|default}、${KEY|}、$${KEY} 变量语法
- 使用 @sinclair/typebox + ajv 实现运行时严格契约校验和 JSON Schema 导出
- 新增 scripts/generate-config-schema.ts 和 config.schema.json
- 新增 bun run schema / schema:check 命令,check 先执行 schema:check
- 更新 README.md 和 DEVELOPMENT.md 匹配新配置体系
- 新增变量解析、schema 校验和 schema 同步测试
55 lines
1.2 KiB
JSON
55 lines
1.2 KiB
JSON
{
|
|
"additionalProperties": false,
|
|
"type": "object",
|
|
"properties": {
|
|
"server": {
|
|
"additionalProperties": false,
|
|
"type": "object",
|
|
"properties": {
|
|
"listen": {
|
|
"additionalProperties": false,
|
|
"type": "object",
|
|
"properties": {
|
|
"host": {
|
|
"type": "string"
|
|
},
|
|
"port": {
|
|
"anyOf": [
|
|
{
|
|
"maximum": 65535,
|
|
"minimum": 0,
|
|
"type": "integer"
|
|
},
|
|
{
|
|
"pattern": "^\\$\\{[^}]+\\}$",
|
|
"type": "string"
|
|
}
|
|
]
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"variables": {
|
|
"type": "object",
|
|
"patternProperties": {
|
|
"^[a-zA-Z_][a-zA-Z0-9_]*$": {
|
|
"anyOf": [
|
|
{
|
|
"type": "string"
|
|
},
|
|
{
|
|
"type": "number"
|
|
},
|
|
{
|
|
"type": "boolean"
|
|
}
|
|
]
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"$id": "https://app.local/config.schema.json",
|
|
"$schema": "http://json-schema.org/draft-07/schema#"
|
|
}
|