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

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
}
}
}
}

View File

@@ -105,7 +105,7 @@
</td>
</tr>
<tr>
<tr v-if="serverType == 'httpProxy' || serverType == 'httpWeb'">
<td>默认开启配置</td>
<td>
<checkbox checked="checked" name="accessLogIsOn">访问日志</checkbox>
@@ -117,6 +117,8 @@
<checkbox name="wafIsOn">WAF</checkbox>
&nbsp; &nbsp;
<checkbox name="remoteAddrIsOn">从上级代理中读取IP <tip-icon content="用来支持读取上级代理传递的X-Real-IP、X-Forwarded-For等信息。如果用户需要通过别的代理服务才能访问到这个网站服务才需要选中。"></tip-icon> </checkbox>
&nbsp; &nbsp;
<checkbox name="statIsOn">统计</checkbox>
</td>
</tr>