Skip to content

Commit

Permalink
disable rate limiter for local, staging envs
Browse files Browse the repository at this point in the history
  • Loading branch information
rastislav-chynoransky committed Apr 18, 2024
1 parent 2b43897 commit dd10a41
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 4 additions & 1 deletion app/Providers/RouteServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,10 @@ public function boot()
protected function configureRateLimiting()
{
RateLimiter::for('api', function (Request $request) {
if (in_array($request->ip(), config('app.rate_limiter.whitelisted_ip_addresses'))) {
if (
$this->app->environment(['local', 'staging']) ||
in_array($request->ip(), config('app.rate_limiter.whitelisted_ip_addresses'))
) {
return Limit::none();
}

Expand Down
4 changes: 1 addition & 3 deletions config/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,6 @@
'iip_public' => env('IIP_PUBLIC', 'https://img.webumenia.sk'),

'rate_limiter' => [
'whitelisted_ip_addresses' => env('RATE_LIMITER_WHITELISTED_IP_ADDRESSES')
? explode(',', env('RATE_LIMITER_WHITELISTED_IP_ADDRESSES'))
: [],
'whitelisted_ip_addresses' => ['195.210.28.242'],
],
];

0 comments on commit dd10a41

Please sign in to comment.