mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-06 06:40:27 +08:00
集群可以设置默认的WAF策略、缓存策略
This commit is contained in:
@@ -22,15 +22,15 @@ func FindCachePolicyNameWithoutError(parent *actionutils.ParentAction, cachePoli
|
||||
|
||||
// 查找缓存策略配置
|
||||
func FindCachePolicy(parent *actionutils.ParentAction, cachePolicyId int64) (*serverconfigs.HTTPCachePolicy, error) {
|
||||
resp, err := parent.RPC().HTTPCachePolicyRPC().FindEnabledHTTPCachePolicyConfig(parent.AdminContext(), &pb.FindEnabledHTTPCachePolicyConfigRequest{CachePolicyId: cachePolicyId})
|
||||
resp, err := parent.RPC().HTTPCachePolicyRPC().FindEnabledHTTPCachePolicyConfig(parent.AdminContext(), &pb.FindEnabledHTTPCachePolicyConfigRequest{HttpCachePolicyId: cachePolicyId})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if len(resp.CachePolicyJSON) == 0 {
|
||||
if len(resp.HttpCachePolicyJSON) == 0 {
|
||||
return nil, errors.New("cache policy not found")
|
||||
}
|
||||
config := &serverconfigs.HTTPCachePolicy{}
|
||||
err = json.Unmarshal(resp.CachePolicyJSON, config)
|
||||
err = json.Unmarshal(resp.HttpCachePolicyJSON, config)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user