Skip to content
Snippets Groups Projects
Commit e5498090 authored by jurgenhaas's avatar jurgenhaas
Browse files

#12 Allow hash_salt to be configured instead of being random

parent 27692860
Branches
Tags
1 merge request!37Merging develop into main
Pipeline #781651 passed
......@@ -63,6 +63,21 @@ class Handler extends BaseHandler {
];
}
/**
* {@inheritdoc}
*/
protected function postInit(): void {
$hash = $this->config->readValue('hash_salt');
if ($hash === NULL) {
try {
$hash = str_replace(['+', '/', '='], ['-', '_', ''], base64_encode(random_bytes(55)));
} catch (Exception $e) {
$hash = 'no-random-bytes-available';
}
}
$this->config->setValue('hash', $hash, FALSE);
}
/**
* Post project create event to setup Drupal environment.
*/
......@@ -114,14 +129,6 @@ class Handler extends BaseHandler {
}
// Link Drupal site's settings files.
try {
$hash = str_replace(['+', '/', '='], ['-', '_', ''], base64_encode(random_bytes(55)));
}
catch (Exception $e) {
$hash = 'no-random-bytes-available';
}
$this->config->setValue('hash', $hash, FALSE);
$settings_files = [
'settings.php',
'settings.local.php',
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment