Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
chore: add skipper for rate limiter (#7014)
Danny Xu4799da35a043
diff --git a/backend/server/server.go b/backend/server/server.goindex c944985367..2f0e5554bf 100644--- a/backend/server/server.go+++ b/backend/server/server.go@@ -349,16 +349,18 @@ func NewServer(ctx context.Context, profile config.Profile) (*Server, error) {e.Debug = profile.Debuge.HideBanner = truee.HidePort = true+ grpcSkipper := func(c echo.Context) bool {+ // Skip grpc and webhook calls.+ return strings.HasPrefix(c.Request().URL.Path, "/bytebase.v1.") ||+ strings.HasPrefix(c.Request().URL.Path, "/v1:adminExecute") ||+ strings.HasPrefix(c.Request().URL.Path, webhookAPIPrefix)+ }e.Use(middleware.TimeoutWithConfig(middleware.TimeoutConfig{- Skipper: func(c echo.Context) bool {- // Skip grpc and webhook calls.- return strings.HasPrefix(c.Request().URL.Path, "/bytebase.v1.") ||- strings.HasPrefix(c.Request().URL.Path, webhookAPIPrefix) ||- strings.HasPrefix(c.Request().URL.Path, "/v1:adminExecute")- },+ Skipper: grpcSkipper,Timeout: 30 * time.Second,}))e.Use(middleware.RateLimiterWithConfig(middleware.RateLimiterConfig{+ Skipper: grpcSkipper,Store: middleware.NewRateLimiterMemoryStoreWithConfig(middleware.RateLimiterMemoryStoreConfig{Rate: 30, Burst: 60, ExpiresIn: 3 * time.Minute},),@@ -534,9 +536,12 @@ func NewServer(ctx context.Context, profile config.Profile) (*Server, error) {}recoveryUnaryInterceptor := recovery.UnaryServerInterceptor(recovery.WithRecoveryHandler(onPanic))recoveryStreamInterceptor := recovery.StreamServerInterceptor(recovery.WithRecoveryHandler(onPanic))+ grpc.EnableTracing = trues.grpcServer = grpc.NewServer(// Override the maximum receiving message size to 100M for uploading large sheets.grpc.MaxRecvMsgSize(100*1024*1024),+ grpc.InitialWindowSize(100000000),+ grpc.InitialConnWindowSize(100000000),grpc.ChainUnaryInterceptor(debugProvider.DebugInterceptor,authProvider.AuthenticationInterceptor,