-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Don't instantiate Dotenv if .env file not exists #670
Conversation
This optimization makes sense but I think it changes the behaviour when a Before: dotenv would throw an exception letting you know it's required |
: ['.env']; | ||
|
||
$dotenv = Dotenv\Dotenv::createUnsafeImmutable($root_dir, $env_files, false); | ||
|
||
$dotenv->load(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@swalkinshaw, I think you're wrong. The exception could be thrown here when $dotenv->load()
is calling. But it is already inside if
statement. BTW, anyway I think that .env
file should not be required.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah yes, that's correct 👍
Thanks @voronkovich |
commit eead6f6 Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Date: Thu Oct 12 16:49:31 2023 -0500 fix(deps): ⬆️ bump roots/wordpress to v6.3.2 (roots#689) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> commit d5ee9d5 Author: Ben Word <ben@benword.com> Date: Tue Oct 10 19:25:07 2023 -0500 📝 Update README [ci skip] commit a90180a Author: Ben Word <ben@benword.com> Date: Wed Sep 27 10:10:41 2023 -0500 📝 Update README [ci skip] commit 64a5624 Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Date: Tue Aug 29 09:59:58 2023 -0500 fix(deps): ⬆️ bump roots/wordpress to v6.3.1 (roots#685) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> commit 149bdab Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Date: Tue Aug 15 08:52:55 2023 -0500 fix(deps): ⬆️ bump wpackagist-theme/twentytwentythree to v1.2 (roots#683) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> commit 7aa70cd Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Date: Tue Aug 8 17:14:03 2023 -0500 fix(deps): ⬆️ bump roots/wordpress to v6.3 (roots#682) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> commit 50a86d4 Author: Scott Walkinshaw <scott.walkinshaw@gmail.com> Date: Sat Jul 15 20:32:00 2023 -0400 Remove post install .env copy (roots#595) `.env.example` is just an example and doesn't contain useful defaults. Copying this file can be confusing since it needs to be edited regardless. By not copying this file, we'll surface errors of missing config values sooner since they'll be no default values. commit 9223c3b Author: Dareth NHANG <DSGND@users.noreply.github.com> Date: Tue Jun 13 20:04:50 2023 +0200 Support `local` as `WP_ENVIRONMENT_TYPE` (roots#681) commit 052bf9d Author: Scott Walkinshaw <scott.walkinshaw@gmail.com> Date: Tue Jun 6 08:48:46 2023 -0400 Add integration test workflow (roots#678) commit 8bc7fb4 Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Date: Mon May 22 10:16:24 2023 -0500 fix(deps): ⬆️ bump roots/wordpress to v6.2.2 (roots#677) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> commit 5993b4e Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Date: Tue May 16 15:40:25 2023 -0500 fix(deps): ⬆️ bump roots/wordpress to v6.2.1 (roots#676) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> commit 96dbd4e Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Date: Mon Apr 17 17:38:58 2023 -0500 fix(deps): ⬆️ bump wpackagist-theme/twentytwentythree to v1.1 (roots#675) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> commit a4eb209 Author: Ben Word <ben@benword.com> Date: Wed Mar 29 16:38:02 2023 -0500 🔥 Delete CHANGELOG commit 6713c24 Author: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Date: Wed Mar 29 16:36:38 2023 -0500 fix(deps): ⬆️ bump roots/wordpress to v6.2 (roots#673) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> commit 09627b1 Author: Ben Word <ben@benword.com> Date: Tue Mar 7 18:30:36 2023 -0600 📝 Update README [ci skip] commit cbc53e0 Author: Ben Word <ben@benword.com> Date: Wed Mar 1 17:33:36 2023 -0600 💡 Update comments commit de66196 Author: Oleg Voronkovich <oleg-voronkovich@yandex.ru> Date: Wed Mar 1 20:53:06 2023 +0300 Don't instantiate Dotenv if .env file not exists (roots#670) commit 20167f3 Author: Ben Word <ben@benword.com> Date: Tue Feb 28 00:04:13 2023 -0600 📝 Update README commit e14658b Author: Oleg Voronkovich <oleg-voronkovich@yandex.ru> Date: Thu Feb 16 01:31:08 2023 +0300 Support WP_ENVIRONMENT_TYPE (roots#668)
In
production
environment.env
files are never used, so we don't need to createDotenv
instance if.env
file not exists.