feat(config): add Route and RouteType fields to LuaScriptConfig

Add route-based matching support for Lua scripts as an alternative to
phase-based execution. Scripts can now be matched by path patterns.

Fields added:
- Route: path/pattern for route matching (mutually exclusive with Phase)
- RouteType: matching type (exact, prefix, prefix_priority, regex, regex_caseless)

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
xfy 2026-05-09 11:36:13 +08:00
parent f3f92c7922
commit ceb71cd9cc

View File

@ -149,10 +149,19 @@ type LuaScriptConfig struct {
// Path 脚本路径 // Path 脚本路径
Path string `yaml:"path"` Path string `yaml:"path"`
// Phase 执行阶段 // Phase 执行阶段(与 Route 互斥)
// 可选值rewrite、access、content、log、header_filter、body_filter // 可选值rewrite、access、content、log、header_filter、body_filter
Phase string `yaml:"phase"` Phase string `yaml:"phase"`
// Route 路由匹配路径/模式(与 Phase 互斥)
// 当设置此字段时,脚本将按路由匹配执行而非阶段执行
Route string `yaml:"route"`
// RouteType 路由匹配类型
// 可选值exact、prefix、prefix_priority、regex、regex_caseless
// 默认值prefix当 Route 设置时)
RouteType string `yaml:"route_type"`
// Timeout 执行超时 // Timeout 执行超时
Timeout time.Duration `yaml:"timeout"` Timeout time.Duration `yaml:"timeout"`