skovmand
4145
15
Laravel

Config:cache makes variables in .env null

Posted 3 years ago by skovmand

I'm confused and hope you can help!

After I run php artisan config:cache the variables set in my .env-file are not being read properly in the application and if I do php artisan tinker I get:

>>> env('S3_KEY');
=> null

after doing php artisan config:clear everything is back to normal:

>>> env('S3_KEY');
=> "AERIAOEBNOIAERGOIEAJRI" // not my real key

How come config:cache has this effect? Is it because I use e.g. S3_KEY in a config.php-file? Which is then set to null?

Please sign in or create an account to participate in this conversation.