Skip to content

Commit

Permalink
[fix]bug
Browse files Browse the repository at this point in the history
  • Loading branch information
piupuer committed Oct 10, 2024
1 parent 27b8c05 commit 45f0c30
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 21 deletions.
4 changes: 1 addition & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ require (
github.com/go-cinch/common/id v1.0.4
github.com/go-cinch/common/idempotent v1.0.4
github.com/go-cinch/common/jwt v1.0.3
github.com/go-cinch/common/log v1.1.0
github.com/go-cinch/common/log v1.1.1
github.com/go-cinch/common/middleware/i18n v1.0.5
github.com/go-cinch/common/middleware/logging v1.0.0
github.com/go-cinch/common/middleware/tenant v1.0.1
Expand All @@ -31,7 +31,6 @@ require (
github.com/golang-jwt/jwt/v4 v4.5.0
github.com/golang-module/carbon/v2 v2.3.12
github.com/google/wire v0.6.0
github.com/gorilla/handlers v1.5.1
github.com/pkg/errors v0.9.1
github.com/redis/go-redis/v9 v9.2.1
github.com/thoas/go-funk v0.9.3
Expand All @@ -56,7 +55,6 @@ require (
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
github.com/felixge/httpsnoop v1.0.1 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/go-cinch/common/migrate v1.0.4 // indirect
github.com/go-cinch/common/nx v1.0.4 // indirect
Expand Down
7 changes: 2 additions & 5 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ github.com/envoyproxy/go-control-plane v0.12.1-0.20240621013728-1eb8caab5155 h1:
github.com/envoyproxy/go-control-plane v0.12.1-0.20240621013728-1eb8caab5155/go.mod h1:5Wkq+JduFtdAXihLmeTJf+tRYIT4KBc2vPXDhwVo1pA=
github.com/envoyproxy/protoc-gen-validate v1.0.4 h1:gVPz/FMfvh57HdSJQyvBtF00j8JU4zdyUgIUNhlgg0A=
github.com/envoyproxy/protoc-gen-validate v1.0.4/go.mod h1:qys6tmnRsYrQqIhm2bvKZH4Blx/1gTIZ2UKVY1M+Yew=
github.com/felixge/httpsnoop v1.0.1 h1:lvB5Jl89CsZtGIWuTcDM1E/vkVs49/Ml7JJe07l8SPQ=
github.com/felixge/httpsnoop v1.0.1/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U=
github.com/frankban/quicktest v1.14.4 h1:g2rn0vABPOOXmZUj+vbmUp0lPoXEMuhTpIluN0XL9UY=
github.com/frankban/quicktest v1.14.4/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0=
github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY=
Expand All @@ -47,8 +45,9 @@ github.com/go-cinch/common/idempotent v1.0.4 h1:E/Ab+FHWjs1ym0U0mips6MyHEzucEded
github.com/go-cinch/common/idempotent v1.0.4/go.mod h1:t4rBikz+RhpmF0tdGx+rm0Z1FzDy/6GtelgFB7RlaiY=
github.com/go-cinch/common/jwt v1.0.3 h1:/jznvjevW+2KsmWm666O1NxkHLSfVmrjoWwkuWAqewk=
github.com/go-cinch/common/jwt v1.0.3/go.mod h1:++p7kddWh9SyCYIYWEb5mfiR+ljKC3I5puiyjz7oGNs=
github.com/go-cinch/common/log v1.1.0 h1:Biq7f8fIoGeuAlqoRFer/ldmoQlAKQK1ZXWxw1qsKSc=
github.com/go-cinch/common/log v1.1.0/go.mod h1:O4k/ArEdZS6c+YPKdESWJnVfhQ0QlwtIQ6mYxJZt5po=
github.com/go-cinch/common/log v1.1.1 h1:9ot3Qw4BKDfOZ7IC/3ZreuYJb953YD7pmM6ev6xT9FY=
github.com/go-cinch/common/log v1.1.1/go.mod h1:O4k/ArEdZS6c+YPKdESWJnVfhQ0QlwtIQ6mYxJZt5po=
github.com/go-cinch/common/middleware/i18n v1.0.5 h1:SmxEMljqYF8xraaaa3KZgvNbKIE06ShQAZ34w87wkvs=
github.com/go-cinch/common/middleware/i18n v1.0.5/go.mod h1:TiyZB9yzBx+giZqngOPQDXtDtYnqgMUgGqs4ebCgnQU=
github.com/go-cinch/common/middleware/logging v1.0.0 h1:QElVRTRc67g2b/G/6TYtnS3YbtFKEcly8OOo6+usZQ8=
Expand Down Expand Up @@ -138,8 +137,6 @@ github.com/google/wire v0.6.0 h1:HBkoIh4BdSxoyo9PveV8giw7ZsaBOvzWKfcg/6MrVwI=
github.com/google/wire v0.6.0/go.mod h1:F4QhpQ9EDIdJ1Mbop/NZBRB+5yrR6qg3BnctaoUk6NA=
github.com/gorhill/cronexpr v0.0.0-20180427100037-88b0669f7d75 h1:f0n1xnMSmBLzVfsMMvriDyA75NB/oBgILX2GcHXIQzY=
github.com/gorhill/cronexpr v0.0.0-20180427100037-88b0669f7d75/go.mod h1:g2644b03hfBX9Ov0ZBDgXXens4rxSxmqFBbhvKv2yVA=
github.com/gorilla/handlers v1.5.1 h1:9lRY6j8DEeeBT10CvO9hGW0gmky0BprnvDI5vfhUHH4=
github.com/gorilla/handlers v1.5.1/go.mod h1:t8XrUpc4KVXb7HGyJ4/cEnwQiaxrX/hz1Zv/4g96P1Q=
github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI=
github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So=
github.com/grpc-ecosystem/grpc-gateway/v2 v2.22.0 h1:asbCHRVmodnJTuQ3qamDwqVOIjwqUPTYmYuemVOx+Ys=
Expand Down
11 changes: 5 additions & 6 deletions internal/server/grpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,16 @@ func NewGRPCServer(
svc *service.AuthService,
whitelist *biz.WhitelistUseCase,
) *grpc.Server {
middlewares := []middleware.Middleware{
recovery.Recovery(),
tenantMiddleware.Tenant(),
ratelimit.Server(),
}
var middlewares []middleware.Middleware
if c.Tracer.Enable {
middlewares = append(middlewares, tracing.Server(), traceMiddleware.Id())
}

middlewares = append(
middlewares,
recovery.Recovery(),
tenantMiddleware.Tenant(),
ratelimit.Server(),
localMiddleware.Header(),
logging.Server(),
i18nMiddleware.Translator(i18n.WithLanguage(language.Make(c.Server.Language)), i18n.WithFs(locales)),
metadata.Server(),
Expand Down
11 changes: 5 additions & 6 deletions internal/server/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,16 @@ func NewHTTPServer(
svc *service.AuthService,
whitelist *biz.WhitelistUseCase,
) *http.Server {
middlewares := []middleware.Middleware{
recovery.Recovery(),
tenantMiddleware.Tenant(),
ratelimit.Server(),
localMiddleware.Header(),
}
var middlewares []middleware.Middleware
if c.Tracer.Enable {
middlewares = append(middlewares, tracing.Server(), traceMiddleware.Id())
}
middlewares = append(
middlewares,
recovery.Recovery(),
tenantMiddleware.Tenant(),
ratelimit.Server(),
localMiddleware.Header(),
logging.Server(),
i18nMiddleware.Translator(i18n.WithLanguage(language.Make(c.Server.Language)), i18n.WithFs(locales)),
metadata.Server(),
Expand Down
2 changes: 1 addition & 1 deletion internal/server/middleware/header.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ func Header() middleware.Middleware {
tr.ReplyHeader().Set("x-content-type-options", "nosniff")
tr.ReplyHeader().Set("x-xss-protection", "1; mode=block")
tr.ReplyHeader().Set("x-frame-options", "deny")
tr.ReplyHeader().Set("Cache-Control", "private")
tr.ReplyHeader().Set("cache-control", "private")
}
}
}
Expand Down

0 comments on commit 45f0c30

Please sign in to comment.