[frontend-gray] 微前端灰度 场景,支持 IncludePathPrefixes字段 (#1666)

This commit is contained in:
mamba
2025-01-13 16:24:51 +08:00
committed by GitHub
parent 817061c6cc
commit b3d9123d59
3 changed files with 10 additions and 1 deletions

View File

@@ -64,7 +64,13 @@ func IsRequestSkippedByHeaders(grayConfig config.GrayConfig) bool {
}
func IsGrayEnabled(grayConfig config.GrayConfig, requestPath string) bool {
// 当前路径中前缀为 SkipedRoute则不走插件逻辑
for _, prefix := range grayConfig.IncludePathPrefixes {
if strings.HasPrefix(requestPath, prefix) {
return true
}
}
// 当前路径中前缀为 SkippedPathPrefixes则不走插件逻辑
for _, prefix := range grayConfig.SkippedPathPrefixes {
if strings.HasPrefix(requestPath, prefix) {
return false