From b2781b890e5f988f847e716e6abbc48e34c3cc5c Mon Sep 17 00:00:00 2001 From: Scott Walkinshaw Date: Fri, 28 May 2021 22:23:14 -0400 Subject: [PATCH] Support .env.local config override (#594) If `.env.local` exists, any values will override and take precedence over those in `.env`. This is meant for local development only. --- CHANGELOG.md | 1 + config/application.php | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5271d76a3d..a9f0ffd250 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/config/application.php b/config/application.php index d558a856a2..b108e5ea34 100644 --- a/config/application.php +++ b/config/application.php @@ -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']);