Files
chongming-core/config.toml
T
2026-08-27 10:13:03 +08:00

149 lines
4.4 KiB
TOML
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.
[default]
app.debug = false
app.description = "基于 FastAPI 的 chongming 打包脚手架"
app.name = "chongming"
app.version = "chongming"
env = "development"
prefix = "/api/v1"
upload_path = "uploads"
[zenoh]
json5_path = "./config/zenoh_config.json5"
[cache]
backend = "diskcache" # "diskcache"(默认) | "redis"
cache_store_path = "./cache_data"
# 启动时该类 worker 的全局副本数优先来源(指 config/workers/<type>/config.toml 的 count):
# "toml" (默认) = 经典模式:启动时用 toml 的 count 覆盖 cache 并写回为新的全局总量
# "cache" = 全局模式:chongming-cache 为单一事实来源,toml 仅在 cache 缺失时引导
launch_worker_count = "toml"
# redis 后端专用(backend = "redis" 时生效,均有默认值)
# redis_host = "127.0.0.1"
# redis_port = 6379
# redis_db = 0
# redis_password = ""
# redis_prefix = "chongming:"
[security]
algorithm = "HS256"
secret_key = "your-secret-key-change-in-production"
[development]
debug = true
env = "development"
[development.server]
access_log = false
host = "0.0.0.0"
port = 8000
reload = true
[development.logging]
file = "logs"
format = "%(asctime)s - %(name)s - %(levelname)s - %(message)s"
level = "DEBUG"
# access 日志采样率:0.1 = 只记录 10% 的成功请求(错误 >=400 始终全量)
# 1.0 = 全量记录;配合异步日志队列降低高吞吐下主线程开销
access_sample_rate = 0.1
[development.cors]
allow_credentials = true
allow_headers = ["*"]
allow_methods = ["*"]
# 注意:allow_credentials=true 时 allow_origins 不能为 ["*"](starlette 会丢弃该 header),
# 需显式列出来源;本地前端 dev 为 http://localhost:5173。
allow_origins = ["http://localhost:5173", "http://127.0.0.1:5173"]
[development.mqtt]
enabled = true
host = "0.0.0.0"
port = 1883
# 是否由网关启动内嵌 amqtt Broker 子进程:
# true (默认)= 网关自带 amqtt Broker,host/port 为 Broker 监听地址
# false = 使用外部 MQTT Broker,网关仅启动 Bridge 客户端连接
# host/port 需指向外部 Broker 地址(如 "192.168.1.10")
use_embedded_broker = true
# MQTT Broker 认证(可选,默认匿名):
# - 内嵌 Broker(use_embedded_broker=true):配置后要求所有客户端(含网关 Bridge)
# 用该账号密码连接,未配置则保持匿名
# - 外部 Broker:网关 Bridge 用该账号密码连接(broker 侧自行配置对应账号)
# 注意:密码为明文存储,生产环境建议使用外部 Broker + 环境变量注入
# username = "chongming"
# password = "change-me"
# MQTT Bridge 额外订阅主题推荐声明在各插件自己的配置里:
# config/workers/<type>/config.toml → [[workers.mqtt_topics]]
# (如 aibox_sophon_adapter 插件的 /board_ping 心跳主题)
# 全局 [<env>.mqtt].custom_topics 仍可作为通用兜底(可选,不推荐)。
[development.mqtt.broker]
# amqtt Broker 可选配置,默认允许匿名连接
# 详细参数参考: https://github.com/Yakifo/amqtt
[plugins_worker]
config_path = "./config/workers/config.toml"
[pyinstaller_build_import]
base = [
"utils", # public 骨架
"utils.launch",
"utils.config",
"zenoh",
"chongming_worker",
"chongming_worker.contracts",
"chongming_worker.route_config",
"chongming_worker.routes_publisher",
"chongming_request",
"server",
"module_bank", # 模块化打包工具
"sqlite_vfs",
"sqlite_vfs.core",
"fastapi", # web 应用依赖
"fastapi.staticfiles",
"fastapi.middleware.cors",
"fastapi.middleware.gzip",
"uvicorn",
"apscheduler",
"diskcache",
"chongming_cache",
"chongming_cache.backends",
"chongming_cache.backends.disk",
"orjson",
"python_multipart",
"volcenginesdkarkruntime",
"chongming_jwt",
"chongming_database",
"chongming_config",
"chongming_password",
"chongming_stream_manager",
"chongming_mqtt",
"chongming_mqtt.mqtt_forward",
"chongming_mqtt.mqtt_subscribe",
"chongming_mqtt.internal_mqtt",
"aiosqlite",
"asyncpg",
"aiofiles.os",
"sqlmodel",
"amqtt",
"bytedance",
"bytedance.volcengine_aicc_sdk",
"bytedance.volcengine_aicc_sdk.secure_http_client",
"aiofiles",
"openai",
]
linux = [
"gunicorn.glogging",
"gunicorn.app",
"gunicorn.app.wsgiapp",
]
windows = []
[production.module_system]
path = [
["resources/app.mbank", "src/chongming/app", "app"],
["resources/plugins.mbank", "src/plugins", "plugins"],
]
type = "module-bank"