Skip to content

Commit

Permalink
Merge pull request #230 from HiEventsDev/make-rate-limit-configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
daveearley authored Sep 16, 2024
2 parents 19575f2 + 953272c commit e638089
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion backend/app/Providers/RouteServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ class RouteServiceProvider extends ServiceProvider
public function boot(): void
{
RateLimiter::for('api', function (Request $request) {
return Limit::perMinute(120)->by($request->user()?->id ?: $request->ip());
return Limit::perMinute(config('app.api_rate_limit_per_minute'))
->by($request->user()?->id ?: $request->ip());
});

$this->routes(function () {
Expand Down
1 change: 1 addition & 0 deletions backend/config/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
'saas_mode_enabled' => env('APP_SAAS_MODE_ENABLED', false),
'saas_stripe_application_fee_percent' => env('APP_SAAS_STRIPE_APPLICATION_FEE_PERCENT', 1.5),
'disable_registration' => env('APP_DISABLE_REGISTRATION', false),
'api_rate_limit_per_minute' => env('APP_API_RATE_LIMIT_PER_MINUTE', 180),

/**
* The number of page views to batch before updating the database
Expand Down

0 comments on commit e638089

Please sign in to comment.