Laravel-EnvEditor
Laravel-EnvEditor copied to clipboard
🐞 Bug - Custom `.env` files not loaded/manageable
Issue description
Example setup with following .env files:
.envwithAPP_ENV="production".env.testingwithAPP_ENV="testing"
When you run with an .env file which differs in name from the default .env file (e.g. .env.testing),
as following:
php artisan serve --ansi --port 8081 --env testing
The default .env file (APP_ENV="production") will still be displayed in the _currentEnv.blade.php view-component.
Expected behavior
The contents of the correct .env file (e.g. .env.testing / APP_ENV="testing") will be visible/manageable,
when running the application with a corresponding custom --env parameter (e.g. --env testing).
This change could solve the issue you describe, but I am not sure if it counts as breaking or not
// Helpers/EnvFilesManager.php:154
protected function getEnvFileName(): string
{
return app()->environmentFile();
}
Thank you for the suggestion, it works in my tests!
I'll take this on,
have an idea for a non-breaking / optional implementation.
PR will follow shortly.
~~Hmmm, I mean draft will follow shortly.. :smile:~~
~~Seems that reading the correct .env works correctly now,~~
~~but writing fails.. :thinking:~~
Seems like that was just a caching issue, after clearing caches/restarting it works! :tada:
(I can view .env.development + create new setting in it + modify it + delete it)
Just switched from my forked version to upstream v3.1.0,
and can confirm that the issue has been resolved! :partying_face:
I assume through PR: https://github.com/GeoSot/Laravel-EnvEditor/pull/47