Skip to content

Commit

Permalink
Support .env.local config override
Browse files Browse the repository at this point in the history
If `.env.local` exists, any values will override and take precedence
over those in `.env`.

This is meant for local development only.
  • Loading branch information
swalkinshaw committed May 29, 2021
1 parent 28374de commit 75040b8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
### HEAD
* Support `.env.local` config override ([#594](https://github.com/roots/bedrock/pull/594))
* Use Bedrock disallow indexing package ([#521](https://github.com/roots/bedrock/pull/521))

### 1.15.4: 2021-05-19
Expand Down
3 changes: 2 additions & 1 deletion config/application.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@

/**
* Use Dotenv to set required environment variables and load .env file in root
* .env.local will override .env if it exists
*/
$dotenv = Dotenv\Dotenv::createUnsafeImmutable($root_dir);
$dotenv = Dotenv\Dotenv::createUnsafeImmutable($root_dir, ['.env', '.env.local'], false);
if (file_exists($root_dir . '/.env')) {
$dotenv->load();
$dotenv->required(['WP_HOME', 'WP_SITEURL']);
Expand Down

0 comments on commit 75040b8

Please sign in to comment.