0

In my Laravel 7.x application, I added some basic configuration to my .env file, eg:

MY_SECRET_KEY=foo

In my controller, I am attempting to read in the value via the following:

Log::debug("ENV[MY_SECRET_KEY]: " . env('MY_SECRET_KEY'));

The result of the env shows up as an empty string in storage/logs/laravel.log:

[2020-09-05 18:38:58] local.DEBUG: ENV[MY_SECRET_KEY]:

I made sure to restart my docker container and verified that .env is indeed there and contains the populated env var. No typos.

Why else would it be coming up as empty?

randombits
  • 47,058
  • 76
  • 251
  • 433

1 Answers1

3

Probably it's cached. Try this

php artisan config:clear
Irfan
  • 156
  • 1
  • 7