From 81d06d86a1e3be95159f1fbdd2026373aac8192e Mon Sep 17 00:00:00 2001 From: Daniel Love Date: Thu, 20 Jan 2022 16:02:05 -0700 Subject: [PATCH] Updating Dotenv::getConfig to enable Shield by default. Updating readme & change log. --- CHANGELOG.md | 10 +++++++++- README.md | 4 ++-- src/Dotenv.php | 7 +++++-- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2a2fbbe..a465d03 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,13 @@ Updates should follow the [Keep a CHANGELOG](https://keepachangelog.com/) princi ## [Unreleased][unreleased] +## [0.1.13] - 2022-01-20 + +### Fixed + +- Updated Dotenv::getConfig to indeed enable Shield by default. +- Updated Dotenv::getConfig to check for `SHIELD_USERNAME` instead of `SHIELD_USER`. + ## [0.1.12] - 2022-01-20 ### Changed @@ -94,7 +101,8 @@ Updates should follow the [Keep a CHANGELOG](https://keepachangelog.com/) princi **Initial release!** -[unreleased]: https://github.com/unleashedtech/dotenv-drupal/compare/0.1.12...main +[unreleased]: https://github.com/unleashedtech/dotenv-drupal/compare/0.1.13...main +[0.1.12]: https://github.com/unleashedtech/dotenv-drupal/compare/0.1.12...0.1.13 [0.1.12]: https://github.com/unleashedtech/dotenv-drupal/compare/0.1.11...0.1.12 [0.1.11]: https://github.com/unleashedtech/dotenv-drupal/compare/0.1.10...0.1.11 [0.1.10]: https://github.com/unleashedtech/dotenv-drupal/compare/0.1.9...0.1.10 diff --git a/README.md b/README.md index 7e63504..9ba0871 100644 --- a/README.md +++ b/README.md @@ -181,10 +181,10 @@ DOMAINS=foo.example,bar.example,baz.example A boolean allowing the enabling/disabling of Shield module auth functionality. ##### SHIELD_USERNAME -The username for Shield to require if enabled. +The username for Shield to require, if enabled. ##### SHIELD_PASSWORD -The password for Shield to require if enabled. +The password for Shield to require, if enabled. ##### SHIELD_MESSAGE The _public_ message Shield should show in the auth prompt if enabled. diff --git a/src/Dotenv.php b/src/Dotenv.php index ccdec8c..863050f 100644 --- a/src/Dotenv.php +++ b/src/Dotenv.php @@ -117,6 +117,9 @@ public function getConfig(): array if (isset($_SERVER['SHIELD'])) { $config['shield.settings']['shield_enable'] = (bool) $_SERVER['SHIELD']; } + else { + $config['shield.settings']['shield_enable'] = TRUE; + } // Apply configuration based on environment name. switch ($this->getEnvironmentName()) { @@ -159,8 +162,8 @@ public function getConfig(): array // Configure Shield if enabled. if ($config['shield.settings']['shield_enable']) { - if (isset($_SERVER['SHIELD_USER'])) { - $config['shield.settings']['credentials']['shield']['user'] = $_SERVER['SHIELD_USER']; + if (isset($_SERVER['SHIELD_USERNAME'])) { + $config['shield.settings']['credentials']['shield']['user'] = $_SERVER['SHIELD_USERNAME']; } if (isset($_SERVER['SHIELD_PASSWORD'])) { $config['shield.settings']['credentials']['shield']['pass'] = $_SERVER['SHIELD_PASSWORD'];