创建新服务时默认开启配置可以选择统计

This commit is contained in:
GoEdgeLab
2021-12-03 14:55:14 +08:00
parent 314cdcd83c
commit 7db6e536fc
2 changed files with 25 additions and 1 deletions

View File

@@ -89,6 +89,7 @@ func (this *CreateAction) RunPost(params struct {
CacheIsOn bool
WafIsOn bool
RemoteAddrIsOn bool
StatIsOn bool
WebRoot string
@@ -582,6 +583,27 @@ func (this *CreateAction) RunPost(params struct {
this.ErrorPage(err)
return
}
// 统计
if params.StatIsOn {
var statConfig = &serverconfigs.HTTPStatRef{
IsPrior: false,
IsOn: true,
}
statJSON, err := json.Marshal(statConfig)
if err != nil {
this.ErrorPage(err)
return
}
_, err = this.RPC().HTTPWebRPC().UpdateHTTPWebStat(this.AdminContext(), &pb.UpdateHTTPWebStatRequest{
HttpWebId: webConfig.Id,
StatJSON: statJSON,
})
if err != nil {
this.ErrorPage(err)
return
}
}
}
}