lumberjack改造前
This commit is contained in:
@@ -9,6 +9,7 @@ import (
|
||||
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
|
||||
"github.com/TeaOSLab/EdgeCommon/pkg/systemconfigs"
|
||||
"github.com/iwind/TeaGo/actions"
|
||||
"strings"
|
||||
)
|
||||
|
||||
const clickhouseConfigCode = "clickhouseConfig"
|
||||
@@ -28,7 +29,7 @@ func (this *ClickHouseAction) RunGet(params struct{}) {
|
||||
this.ErrorPage(err)
|
||||
return
|
||||
}
|
||||
cfg := &systemconfigs.ClickHouseSetting{Port: 8123, Database: "default"}
|
||||
cfg := &systemconfigs.ClickHouseSetting{Port: 8123, Database: "default", Scheme: "http"}
|
||||
if len(resp.ValueJSON) > 0 {
|
||||
_ = json.Unmarshal(resp.ValueJSON, cfg)
|
||||
}
|
||||
@@ -38,22 +39,31 @@ func (this *ClickHouseAction) RunGet(params struct{}) {
|
||||
if cfg.Database == "" {
|
||||
cfg.Database = "default"
|
||||
}
|
||||
if strings.TrimSpace(cfg.Scheme) == "" {
|
||||
cfg.Scheme = "http"
|
||||
}
|
||||
this.Data["config"] = map[string]interface{}{
|
||||
"host": cfg.Host,
|
||||
"port": cfg.Port,
|
||||
"user": cfg.User,
|
||||
"password": cfg.Password,
|
||||
"database": cfg.Database,
|
||||
"host": cfg.Host,
|
||||
"port": cfg.Port,
|
||||
"user": cfg.User,
|
||||
"password": cfg.Password,
|
||||
"database": cfg.Database,
|
||||
"scheme": cfg.Scheme,
|
||||
"tlsSkipVerify": cfg.TLSSkipVerify,
|
||||
"tlsServerName": cfg.TLSServerName,
|
||||
}
|
||||
this.Show()
|
||||
}
|
||||
|
||||
func (this *ClickHouseAction) RunPost(params struct {
|
||||
Host string
|
||||
Port int
|
||||
User string
|
||||
Password string
|
||||
Database string
|
||||
Host string
|
||||
Port int
|
||||
User string
|
||||
Password string
|
||||
Database string
|
||||
Scheme string
|
||||
TLSSkipVerify bool
|
||||
TLSServerName string
|
||||
|
||||
Must *actions.Must
|
||||
}) {
|
||||
@@ -64,6 +74,9 @@ func (this *ClickHouseAction) RunPost(params struct {
|
||||
if params.Database == "" {
|
||||
params.Database = "default"
|
||||
}
|
||||
if params.Scheme != "https" {
|
||||
params.Scheme = "http"
|
||||
}
|
||||
password := params.Password
|
||||
if password == "" {
|
||||
resp, _ := this.RPC().SysSettingRPC().ReadSysSetting(this.AdminContext(), &pb.ReadSysSettingRequest{Code: clickhouseConfigCode})
|
||||
@@ -75,11 +88,14 @@ func (this *ClickHouseAction) RunPost(params struct {
|
||||
}
|
||||
}
|
||||
cfg := &systemconfigs.ClickHouseSetting{
|
||||
Host: params.Host,
|
||||
Port: params.Port,
|
||||
User: params.User,
|
||||
Password: password,
|
||||
Database: params.Database,
|
||||
Host: params.Host,
|
||||
Port: params.Port,
|
||||
User: params.User,
|
||||
Password: password,
|
||||
Database: params.Database,
|
||||
Scheme: params.Scheme,
|
||||
TLSSkipVerify: params.TLSSkipVerify,
|
||||
TLSServerName: strings.TrimSpace(params.TLSServerName),
|
||||
}
|
||||
valueJSON, err := json.Marshal(cfg)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user