dns clickhouse改造
This commit is contained in:
@@ -87,17 +87,20 @@ func (this *CreatePopupAction) RunPost(params struct {
|
||||
Field("type", params.Type).
|
||||
Require("请选择存储类型")
|
||||
|
||||
baseType, writeTargets := serverconfigs.ParseStorageTypeAndWriteTargets(params.Type)
|
||||
if writeTargets == nil {
|
||||
writeTargets = &serverconfigs.AccessLogWriteTargets{File: true, MySQL: true}
|
||||
baseType, _ := serverconfigs.ParseStorageTypeAndWriteTargets(params.Type)
|
||||
storedType := baseType
|
||||
if serverconfigs.IsFileBasedStorageType(params.Type) {
|
||||
storedType = params.Type
|
||||
}
|
||||
|
||||
var options any = nil
|
||||
switch baseType {
|
||||
case serverconfigs.AccessLogStorageTypeFile:
|
||||
params.Must.
|
||||
Field("filePath", params.FilePath).
|
||||
Require("请输入日志文件路径")
|
||||
if !serverconfigs.IsFileBasedStorageType(params.Type) || (params.Type != serverconfigs.AccessLogStorageTypeFileClickhouse && params.Type != serverconfigs.AccessLogStorageTypeFileMySQLClickhouse) {
|
||||
params.Must.
|
||||
Field("filePath", params.FilePath).
|
||||
Require("请输入日志文件路径")
|
||||
}
|
||||
|
||||
var storage = new(serverconfigs.AccessLogFileStorageConfig)
|
||||
storage.Path = params.FilePath
|
||||
@@ -175,21 +178,15 @@ func (this *CreatePopupAction) RunPost(params struct {
|
||||
this.ErrorPage(err)
|
||||
return
|
||||
}
|
||||
writeTargetsMap := map[string]bool{
|
||||
"file": writeTargets.File,
|
||||
"mysql": writeTargets.MySQL,
|
||||
"clickhouse": writeTargets.ClickHouse,
|
||||
}
|
||||
writeTargetsJSON, _ := json.Marshal(writeTargetsMap)
|
||||
createResp, err := this.RPC().HTTPAccessLogPolicyRPC().CreateHTTPAccessLogPolicy(this.AdminContext(), &pb.CreateHTTPAccessLogPolicyRequest{
|
||||
Name: params.Name,
|
||||
Type: baseType,
|
||||
Type: storedType,
|
||||
OptionsJSON: optionsJSON,
|
||||
CondsJSON: nil, // TODO
|
||||
IsPublic: params.IsPublic,
|
||||
FirewallOnly: params.FirewallOnly,
|
||||
DisableDefaultDB: params.DisableDefaultDB,
|
||||
WriteTargetsJSON: writeTargetsJSON,
|
||||
WriteTargetsJSON: nil,
|
||||
})
|
||||
if err != nil {
|
||||
this.ErrorPage(err)
|
||||
|
||||
Reference in New Issue
Block a user