I set several ENV variables with Laravel Forge which are correctly picked up by the application. However artisan doesn't seem to pick up my environment. php artisan env
returns:
Current application environment: local
In the nginx configuration I also have
fastcgi_param ENV "test";
This is how I detect my environment:
$env = $app->detectEnvironment(function () {
return getenv('ENV') ?: 'local';
});
How can I have artisan think its in the test environment?
Go to your laravel forge site and click on 'Edit Deploy Script'.
Change line 4 to
or whatever env you need.
You will need to do the same when running an artisan command in the console.
Try to verify if your .env file is correctly configured. Take a look in your .env and set this:
after that try to clear your configuration. Type this in your terminal:
and to finish verify your environment with this:
I hope this help you.
Regards!