Skip to content

Commit

Permalink
Updating Dotenv::getSettings to define hash_salt if HASH_SALT environ…
Browse files Browse the repository at this point in the history
…ment variable is set. Revising Dotenv class methods to only use server VIRTUAL_HOST var if defined. Updating change log.
  • Loading branch information
dl-unleashed-technologies committed Nov 29, 2021
1 parent eb36240 commit ae3c0f6
Show file tree
Hide file tree
Showing 2 changed files with 18 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.3] - 2021-11-29

### Fixed

- 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.

## [0.1.2] - 2021-11-29

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

**Initial release!**

[unreleased]: https://github.com/unleashedtech/dotenv-drupal/compare/0.1.2...main
[unreleased]: https://github.com/unleashedtech/dotenv-drupal/compare/0.1.3...main
[0.1.3]: https://github.com/unleashedtech/dotenv-drupal/releases/tag/v0.1.3
[0.1.2]: https://github.com/unleashedtech/dotenv-drupal/releases/tag/v0.1.2
[0.1.1]: https://github.com/unleashedtech/dotenv-drupal/releases/tag/v0.1.1
[0.1.0]: https://github.com/unleashedtech/dotenv-drupal/releases/tag/v0.1.0
13 changes: 9 additions & 4 deletions src/Dotenv.php
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,9 @@ public function getSettings(): array
$settings['container_yamls'] = [
$this->getAppPath() . '/sites/' . $envName . '.services.yml',
];
if (isset($_ENV['HASH_SALT'])) {
$settings['hash_salt'] = $_ENV['HASH_SALT'];
}
switch ($envName) {
case 'dev':
$settings['cache']['bins'] = [
Expand All @@ -200,9 +203,11 @@ public function getSettings(): array
];
$settings['hash_salt'] = 'foo';
$settings['rebuild_access'] = FALSE;
$settings['trusted_host_patterns'] = [
$_SERVER['VIRTUAL_HOST'],
];
if (isset($_SERVER['VIRTUAL_HOST'])) {
$settings['trusted_host_patterns'] = [
$_SERVER['VIRTUAL_HOST'],
];
}
$settings['skip_permissions_hardening'] = TRUE;
$settings['update_free_access'] = FALSE;
}
Expand Down Expand Up @@ -264,7 +269,7 @@ private function replacePlaceholders(string $string): string
$this->getAppPath(),
$this->getProjectPath(),
$this->getSiteName(),
$_SERVER['VIRTUAL_HOST'],
$_SERVER['VIRTUAL_HOST'] ?? NULL,
], $string);
}
}

0 comments on commit ae3c0f6

Please sign in to comment.