Skip to content

Commit

Permalink
fixup! feat(ratelimit): setup rate limiter
Browse files Browse the repository at this point in the history
  • Loading branch information
olexsmir committed Oct 17, 2024
1 parent 8ebcba4 commit b1a6027
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions internal/transport/http/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
}

Expand All @@ -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"))

Expand Down

0 comments on commit b1a6027

Please sign in to comment.