respond icon indicating copy to clipboard operation
respond copied to clipboard

Number of .env file request

Open ili5 opened this issue 8 years ago • 2 comments
trafficstars

Hi, I'm playing with this CMS for few days and I'm really surprised with it :) But I found one problem. Some API requests have 500 error status code without any reason. After some code research I realized that you are calling env("JWT_KEY") for every protected request in App\Respond\Libraries\Utilites.php:514 . That is too much requests in really short time and server cant close file that quick to make it possible to be open again (for next request). So, I found some solution and it's not the best way, so only what you need is to replace $key parameter for JWT::decode method with string which is same as one in .env file. But I'm sure that this is the worst solution, but for my needs it works :)

Cheers

ili5 avatar Mar 19 '17 11:03 ili5

This is very interesting. I have not personally experienced this issue. I wonder if there is a PHP or Laravel solution to caching this across requests. I will see if I can find a solution.

Thanks!

madoublet avatar Mar 20 '17 03:03 madoublet

It is my understanding that in Laravel and Lumen, the correct way to retrieve configuration variables is using the config() helper. See https://lumen.laravel.com/docs/5.5/configuration#accessing-configuration-values . IIRC, when it's done that way the values will get cached by any caching layer that is enabled in Laravel/Lumen. I don't know that it matters that much for the admin area, but it is a good practice to follow.

axis80 avatar Nov 09 '17 22:11 axis80