Skip to content

Commit ae3c0f6

Browse files
Updating Dotenv::getSettings to define hash_salt if HASH_SALT environment variable is set. Revising Dotenv class methods to only use server VIRTUAL_HOST var if defined. Updating change log.
1 parent eb36240 commit ae3c0f6

File tree

2 files changed

+18
-5
lines changed

2 files changed

+18
-5
lines changed

CHANGELOG.md

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

55
## [Unreleased][unreleased]
66

7+
## [0.1.3] - 2021-11-29
8+
9+
### Fixed
10+
11+
- Updating Dotenv::getSettings to define hash_salt if HASH_SALT environment variable is set.
12+
- Revising Dotenv class methods to only use server VIRTUAL_HOST var if defined.
13+
714
## [0.1.2] - 2021-11-29
815

916
### Fixed
@@ -20,7 +27,8 @@ Updates should follow the [Keep a CHANGELOG](https://keepachangelog.com/) princi
2027

2128
**Initial release!**
2229

23-
[unreleased]: https://github.com/unleashedtech/dotenv-drupal/compare/0.1.2...main
30+
[unreleased]: https://github.com/unleashedtech/dotenv-drupal/compare/0.1.3...main
31+
[0.1.3]: https://github.com/unleashedtech/dotenv-drupal/releases/tag/v0.1.3
2432
[0.1.2]: https://github.com/unleashedtech/dotenv-drupal/releases/tag/v0.1.2
2533
[0.1.1]: https://github.com/unleashedtech/dotenv-drupal/releases/tag/v0.1.1
2634
[0.1.0]: https://github.com/unleashedtech/dotenv-drupal/releases/tag/v0.1.0

src/Dotenv.php

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,9 @@ public function getSettings(): array
191191
$settings['container_yamls'] = [
192192
$this->getAppPath() . '/sites/' . $envName . '.services.yml',
193193
];
194+
if (isset($_ENV['HASH_SALT'])) {
195+
$settings['hash_salt'] = $_ENV['HASH_SALT'];
196+
}
194197
switch ($envName) {
195198
case 'dev':
196199
$settings['cache']['bins'] = [
@@ -200,9 +203,11 @@ public function getSettings(): array
200203
];
201204
$settings['hash_salt'] = 'foo';
202205
$settings['rebuild_access'] = FALSE;
203-
$settings['trusted_host_patterns'] = [
204-
$_SERVER['VIRTUAL_HOST'],
205-
];
206+
if (isset($_SERVER['VIRTUAL_HOST'])) {
207+
$settings['trusted_host_patterns'] = [
208+
$_SERVER['VIRTUAL_HOST'],
209+
];
210+
}
206211
$settings['skip_permissions_hardening'] = TRUE;
207212
$settings['update_free_access'] = FALSE;
208213
}
@@ -264,7 +269,7 @@ private function replacePlaceholders(string $string): string
264269
$this->getAppPath(),
265270
$this->getProjectPath(),
266271
$this->getSiteName(),
267-
$_SERVER['VIRTUAL_HOST'],
272+
$_SERVER['VIRTUAL_HOST'] ?? NULL,
268273
], $string);
269274
}
270275
}

0 commit comments

Comments
 (0)