Skip to content

Commit

Permalink
satellite/console: user ID rate limiter applied to daily usage endpoint
Browse files Browse the repository at this point in the history
Applied user ID rate limiter to daily usage endpoint as it's really expensive query.

Issue:
storj/storj-private#567

Change-Id: I2bd1a2ba0945b60aaa472853f465375a3c87f309
  • Loading branch information
VitaliiShpital authored and Storj Robot committed Jan 23, 2024
1 parent 62a3215 commit e211742
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion satellite/console/consoleweb/server.go
Expand Up @@ -292,7 +292,7 @@ func NewServer(logger *zap.Logger, config Config, service *console.Service, oidc
usageLimitsController := consoleapi.NewUsageLimits(logger, service, server.config.AllowedUsageReportDateRange)
projectsRouter.Handle("/{id}/usage-limits", http.HandlerFunc(usageLimitsController.ProjectUsageLimits)).Methods(http.MethodGet, http.MethodOptions)
projectsRouter.Handle("/usage-limits", http.HandlerFunc(usageLimitsController.TotalUsageLimits)).Methods(http.MethodGet, http.MethodOptions)
projectsRouter.Handle("/{id}/daily-usage", http.HandlerFunc(usageLimitsController.DailyUsage)).Methods(http.MethodGet, http.MethodOptions)
projectsRouter.Handle("/{id}/daily-usage", server.userIDRateLimiter.Limit(http.HandlerFunc(usageLimitsController.DailyUsage))).Methods(http.MethodGet, http.MethodOptions)
projectsRouter.Handle("/usage-report", server.userIDRateLimiter.Limit(http.HandlerFunc(usageLimitsController.UsageReport))).Methods(http.MethodGet, http.MethodOptions)

authController := consoleapi.NewAuth(logger, service, accountFreezeService, mailService, server.cookieAuth, server.analytics, config.SatelliteName, server.config.ExternalAddress, config.LetUsKnowURL, config.TermsAndConditionsURL, config.ContactInfoURL, config.GeneralRequestURL, config.SignupActivationCodeEnabled)
Expand Down

0 comments on commit e211742

Please sign in to comment.