From dd10a41a8f0c01fff72e79b4b16fe8a9548b1e46 Mon Sep 17 00:00:00 2001 From: Rastislav Chynoransky Date: Thu, 18 Apr 2024 13:49:14 +0200 Subject: [PATCH] disable rate limiter for local, staging envs --- app/Providers/RouteServiceProvider.php | 5 ++++- config/app.php | 4 +--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/app/Providers/RouteServiceProvider.php b/app/Providers/RouteServiceProvider.php index 6139a7750..3aae7041e 100644 --- a/app/Providers/RouteServiceProvider.php +++ b/app/Providers/RouteServiceProvider.php @@ -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(); } diff --git a/config/app.php b/config/app.php index 9536bbbe7..d1d470c86 100644 --- a/config/app.php +++ b/config/app.php @@ -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'], ], ];