Skip to content

Commit 31d7786

Browse files
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. Updating change log.
1 parent 798ba18 commit 31d7786

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

CHANGELOG.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,18 @@ Updates should follow the [Keep a CHANGELOG](https://keepachangelog.com/) princi
44

55
## [Unreleased][unreleased]
66

7+
## [0.1.11] - 2022-01-07
8+
9+
### Changed
10+
- Updating Dotenv::getConfig to support environments with full "production" name.
11+
- Updating Dotenv::getDatabaseName to provide helpful output in Drush context for multi-site config with dis-allowed default site.
12+
713
## [0.1.10] - 2022-01-04
814

915
### Changed
1016

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

8288
**Initial release!**
8389

84-
[unreleased]: https://github.com/unleashedtech/dotenv-drupal/compare/0.1.10...main
90+
[unreleased]: https://github.com/unleashedtech/dotenv-drupal/compare/0.1.11...main
91+
[0.1.11]: https://github.com/unleashedtech/dotenv-drupal/compare/0.1.9...0.1.11
8592
[0.1.10]: https://github.com/unleashedtech/dotenv-drupal/compare/0.1.9...0.1.10
8693
[0.1.9]: https://github.com/unleashedtech/dotenv-drupal/compare/0.1.8...0.1.9
8794
[0.1.8]: https://github.com/unleashedtech/dotenv-drupal/compare/0.1.7...0.1.8

src/Dotenv.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ public function getConfig(): array
151151
break;
152152

153153
case 'prod':
154+
case 'production':
154155
$config['environment_indicator.indicator'] = [
155156
'name' => 'Production',
156157
'fg_color' => '#ffb6b6',
@@ -195,8 +196,12 @@ public function getDatabaseName(): string
195196
// Multi-site configuration detected. Use the site name.
196197
$result = $this->getSiteName();
197198
if ($result === 'default' && !$this->isMultiSiteDefaultSiteAllowed()) {
198-
header("HTTP/1.1 401 Unauthorized");
199-
die('Unauthorized');
199+
if (PHP_SAPI === 'cli') {
200+
throw new \Exception('The "default" site in this multi-site install is not allowed. Please run something like `drush -l {{site}}` instead.');
201+
} else {
202+
header("HTTP/1.1 401 Unauthorized");
203+
die('Unauthorized');
204+
}
200205
}
201206
} else {
202207
$result = substr($result, 1);

0 commit comments

Comments
 (0)