Expand description
serve 命令 — 启动 HTTP 服务(可选加载 admin 插件)
对齐 PHP php think run,封装 sz_rust_core::server::serve_with_graceful_shutdown。
§用法
# 基础服务(不加载 admin 插件)
sz-rust serve
# 加载 admin 插件
sz-rust serve --with-admin --addr 0.0.0.0:8080
# 生产级配置
sz-rust serve --with-admin --workers 4 --grace-timeout 30 --health --access-logStructs§
- Serve
Args - serve 命令参数集合
Functions§
- build_
router_ with_ admin - 构建 admin 插件路由并注册 Capability
- build_
router_ with_ data_ scope - 构建 data_scope_middleware 路由层
- build_
router_ with_ tenant - 构建 tenant_middleware 路由层
- build_
runtime - 构建 multi-thread tokio runtime
- execute
- 执行 serve 命令(同步入口)
- resolve_
workers - 解析有效 worker 数
- validate_
workers - 校验 worker 数量合法性