Commit 9618b19f authored by qiuqunfeng's avatar qiuqunfeng
Browse files

Refactor import statements in cmd.go and app.go for improved organization; add...

Refactor import statements in cmd.go and app.go for improved organization; add logging in WafLogController for better traceability of proxy requests.
parent cfb942a8
......@@ -11,6 +11,7 @@ import (
"gitlab.com/tensorsecurity-rd/waf-console/cmd/api-server/config"
// "gitlab.com/tensorsecurity-rd/waf-console/cmd/config"
"gitlab.com/tensorsecurity-rd/waf-console/internal/service"
es "gitlab.com/tensorsecurity-rd/waf-console/internal/store"
)
......
......@@ -10,7 +10,6 @@ import (
"github.com/spf13/cobra"
"gitlab.com/tensorsecurity-rd/waf-console/api"
"gitlab.com/tensorsecurity-rd/waf-console/cmd/config"
"gitlab.com/tensorsecurity-rd/waf-console/internal/service"
es "gitlab.com/tensorsecurity-rd/waf-console/internal/store"
"gitlab.com/tensorsecurity-rd/waf-console/internal/utils"
"gorm.io/driver/mysql"
......@@ -86,8 +85,8 @@ func NewRootCommand() *cobra.Command {
ESTimeout: 10 * time.Second,
}, esClient)
esStore.Init()
logConsumerService := service.NewLogConsumerService(db, esStore, config.KafkaConfig)
go logConsumerService.Consume()
// logConsumerService := service.NewLogConsumerService(db, esStore, config.KafkaConfig)
// go logConsumerService.Consume()
return e.Run(":8080")
},
}
......
......@@ -7,6 +7,7 @@ import (
"strings"
"github.com/gin-gonic/gin"
"github.com/rs/zerolog/log"
)
type WafLogController struct {
......@@ -27,6 +28,7 @@ func (c *WafLogController) WafLogProxy(ctx *gin.Context) {
ctx.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()})
return
}
log.Info().Msgf("remoteUrl: %s", remoteUrl.String())
proxy := httputil.NewSingleHostReverseProxy(remoteUrl)
proxy.Director = func(req *http.Request) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment