Skip to content

Commit

Permalink
Updating Dotenv::getConfig to support environments with full "product…
Browse files Browse the repository at this point in the history
…ion" name. Updating Dotenv::getDatabaseName to provide helpful output in Drush context for multi-site config with dis-allowed default site. Updating change log.
  • Loading branch information
dl-unleashed-technologies committed Jan 7, 2022
1 parent 798ba18 commit 31d7786
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
11 changes: 9 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,18 @@ Updates should follow the [Keep a CHANGELOG](https://keepachangelog.com/) princi

## [Unreleased][unreleased]

## [0.1.11] - 2022-01-07

### Changed
- Updating Dotenv::getConfig to support environments with full "production" name.
- Updating Dotenv::getDatabaseName to provide helpful output in Drush context for multi-site config with dis-allowed default site.

## [0.1.10] - 2022-01-04

### Changed

- Disallowed access to `default` site in a multi-site install by default.
- Added support for `$database` variable alteration.
- Added support for `$databases` variable alteration.
- Added support for `FILE_PUBLIC_PATH` environment variable.
- Added support for `FILE_PRIVATE_PATH` environment variable.
- Added support for `FILE_TEMP_PATH` environment variable.
Expand Down Expand Up @@ -81,7 +87,8 @@ Updates should follow the [Keep a CHANGELOG](https://keepachangelog.com/) princi

**Initial release!**

[unreleased]: https://github.com/unleashedtech/dotenv-drupal/compare/0.1.10...main
[unreleased]: https://github.com/unleashedtech/dotenv-drupal/compare/0.1.11...main
[0.1.11]: https://github.com/unleashedtech/dotenv-drupal/compare/0.1.9...0.1.11
[0.1.10]: https://github.com/unleashedtech/dotenv-drupal/compare/0.1.9...0.1.10
[0.1.9]: https://github.com/unleashedtech/dotenv-drupal/compare/0.1.8...0.1.9
[0.1.8]: https://github.com/unleashedtech/dotenv-drupal/compare/0.1.7...0.1.8
Expand Down
9 changes: 7 additions & 2 deletions src/Dotenv.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ public function getConfig(): array
break;

case 'prod':
case 'production':
$config['environment_indicator.indicator'] = [
'name' => 'Production',
'fg_color' => '#ffb6b6',
Expand Down Expand Up @@ -195,8 +196,12 @@ public function getDatabaseName(): string
// Multi-site configuration detected. Use the site name.
$result = $this->getSiteName();
if ($result === 'default' && !$this->isMultiSiteDefaultSiteAllowed()) {
header("HTTP/1.1 401 Unauthorized");
die('Unauthorized');
if (PHP_SAPI === 'cli') {
throw new \Exception('The "default" site in this multi-site install is not allowed. Please run something like `drush -l {{site}}` instead.');
} else {
header("HTTP/1.1 401 Unauthorized");
die('Unauthorized');
}
}
} else {
$result = substr($result, 1);
Expand Down

0 comments on commit 31d7786

Please sign in to comment.