Browse Source

修改bug

yjp 10 months ago
parent
commit
f28b044cab
3 changed files with 7 additions and 4 deletions
  1. 3 1
      baize.go
  2. 1 1
      framework/core/api/options.go
  3. 3 2
      framework/core/application/config.go

+ 3 - 1
baize.go

@@ -9,7 +9,9 @@ import (
 func NewApplication(conf application.Config) *application.App {
 	// 创建API
 	apiConfig := conf.ApiConfig
-	apiInstance := api.New(api.WithUrlPrefix(apiConfig.UrlPrefix), api.WithPort(apiConfig.Port))
+	apiInstance := api.New(api.WithUrlPrefix(apiConfig.UrlPrefix),
+		api.WithPort(apiConfig.Port),
+		api.WithSkipPaths(apiConfig.LogSkipPaths...))
 
 	// 创建基础设施
 	infrastructureConfig := new(infrastructure.Config)

+ 1 - 1
framework/core/api/options.go

@@ -33,7 +33,7 @@ func WithPort(port string) Option {
 	}
 }
 
-func WithSkipPaths(skipPaths []string) Option {
+func WithSkipPaths(skipPaths ...string) Option {
 	return func(options *Options) {
 		options.skipPaths = skipPaths
 	}

+ 3 - 2
framework/core/application/config.go

@@ -15,8 +15,9 @@ type Config struct {
 }
 
 type ApiConfig struct {
-	UrlPrefix string `json:"url_prefix" yaml:"url_prefix"`
-	Port      string `json:"port" yaml:"port"`
+	UrlPrefix    string   `json:"url_prefix" yaml:"url_prefix"`
+	Port         string   `json:"port" yaml:"port"`
+	LogSkipPaths []string `json:"log_skip_paths" yaml:"log_skip_paths"`
 }
 
 type InfrastructureConfig struct {