mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2026-02-24 18:55:39 +08:00
集群可以设置默认的WAF策略、缓存策略
This commit is contained in:
@@ -4,9 +4,11 @@ import (
|
||||
"encoding/json"
|
||||
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/actionutils"
|
||||
"github.com/TeaOSLab/EdgeAdmin/internal/web/actions/default/servers/server/settings/webutils"
|
||||
"github.com/TeaOSLab/EdgeAdmin/internal/web/models"
|
||||
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
|
||||
"github.com/TeaOSLab/EdgeCommon/pkg/serverconfigs"
|
||||
"github.com/iwind/TeaGo/actions"
|
||||
"github.com/iwind/TeaGo/maps"
|
||||
)
|
||||
|
||||
type IndexAction struct {
|
||||
@@ -17,6 +19,7 @@ func (this *IndexAction) Init() {
|
||||
}
|
||||
|
||||
func (this *IndexAction) RunGet(params struct {
|
||||
ServerId int64
|
||||
LocationId int64
|
||||
}) {
|
||||
webConfig, err := webutils.FindWebConfigWithLocationId(this.Parent(), params.LocationId)
|
||||
@@ -28,6 +31,22 @@ func (this *IndexAction) RunGet(params struct {
|
||||
this.Data["webId"] = webConfig.Id
|
||||
this.Data["cacheConfig"] = webConfig.Cache
|
||||
|
||||
// 当前集群的缓存策略
|
||||
cachePolicy, err := models.SharedHTTPCachePolicyDAO.FindEnabledHTTPCachePolicyWithServerId(this.AdminContext(), params.ServerId)
|
||||
if err != nil {
|
||||
this.ErrorPage(err)
|
||||
return
|
||||
}
|
||||
if cachePolicy != nil {
|
||||
this.Data["cachePolicy"] = maps.Map{
|
||||
"id": cachePolicy.Id,
|
||||
"name": cachePolicy.Name,
|
||||
"isOn": cachePolicy.IsOn,
|
||||
}
|
||||
} else {
|
||||
this.Data["cachePolicy"] = nil
|
||||
}
|
||||
|
||||
this.Show()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user