From b1a60278d9f0ba4a27630e0b795b5e2c6a73b27f Mon Sep 17 00:00:00 2001 From: Smirnov Oleksandr Date: Thu, 17 Oct 2024 22:53:41 +0300 Subject: [PATCH] fixup! feat(ratelimit): setup rate limiter --- internal/transport/http/http.go | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/internal/transport/http/http.go b/internal/transport/http/http.go index 366f96a..c59a3af 100644 --- a/internal/transport/http/http.go +++ b/internal/transport/http/http.go @@ -15,20 +15,18 @@ type Transport struct { usersrv usersrv.UserServicer notesrv notesrv.NoteServicer - ratelimitCfg ratelimit.Config - ratelimitCfgResendVerification ratelimit.Config + ratelimitCfg ratelimit.Config } func NewTransport( us usersrv.UserServicer, ns notesrv.NoteServicer, - ratelimitCfg, ratelimitCfgResendVerification ratelimit.Config, + ratelimitCfg ratelimit.Config, ) *Transport { return &Transport{ - usersrv: us, - notesrv: ns, - ratelimitCfg: ratelimitCfg, - ratelimitCfgResendVerification: ratelimitCfgResendVerification, + usersrv: us, + notesrv: ns, + ratelimitCfg: ratelimitCfg, } } @@ -40,7 +38,7 @@ func (t *Transport) Handler() http.Handler { t.logger(), ) - api := r.Group("/api") + api := r.Group("/api", ratelimit.MiddlewareWithConfig(t.ratelimitCfg)) api.GET("/ping", t.pingHandler) apiv1.NewAPIV1(t.usersrv, t.notesrv).Routes(api.Group("/v1"))