Skip to content

Commit

Permalink
Updating Dotenv::getConfig to enable Shield by default. Updating read…
Browse files Browse the repository at this point in the history
…me & change log.
  • Loading branch information
dl-unleashed-technologies committed Jan 20, 2022
1 parent 13d2b44 commit 81d06d8
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
10 changes: 9 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
7 changes: 5 additions & 2 deletions src/Dotenv.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand Down Expand Up @@ -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'];
Expand Down

0 comments on commit 81d06d8

Please sign in to comment.