I run into this issue after I loaded my custom .env.custom
file in AppServiceProvider
:
class AppServiceProvider extends ServiceProvider
{
// ...
public function boot()
{
$host = request()->getHost();
// read domain based .env file, like: .env.example.com
$dotenv = \Dotenv\Dotenv::createMutable(base_path(), '.env.' . $host);
$dotenv->load();
}
}
(I tried with \Dotenv\Dotenv::createImmutable()
too, with same result.)
Then in a controller:
dd(
env('S3_ENDPOINT'),
Storage::disk('s3'),
);
The env()
return with the new value, but the Storage::disk('s3')
contains the old value.
How can I force the whole Laravel system to reload the configuration from the .env.custome
file?