Skip to content

Commit

Permalink
UHF-10311: updated settings.php
Browse files Browse the repository at this point in the history
  • Loading branch information
rpnykanen committed Jul 8, 2024
1 parent 4cc40ea commit 0a68492
Showing 1 changed file with 17 additions and 12 deletions.
29 changes: 17 additions & 12 deletions public/sites/default/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -229,24 +229,30 @@ function drupal_get_env(string|array $variables) : mixed {
}
}
}
$stage_file_proxy_origin = getenv('STAGE_FILE_PROXY_ORIGIN');
$stage_file_proxy_dir = getenv('STAGE_FILE_PROXY_ORIGIN_DIR');

if ($stage_file_proxy_origin = getenv('STAGE_FILE_PROXY_ORIGIN')) {
$config['stage_file_proxy.settings']['origin'] = $stage_file_proxy_origin;
$config['stage_file_proxy.settings']['origin_dir'] = getenv('STAGE_FILE_PROXY_ORIGIN_DIR') ?: 'test';
if ($stage_file_proxy_origin || $stage_file_proxy_dir) {
$config['stage_file_proxy.settings']['origin'] = $stage_file_proxy_origin ?: 'https://stplattaprod.blob.core.windows.net';
$config['stage_file_proxy.settings']['origin_dir'] = $stage_file_proxy_dir;
$config['stage_file_proxy.settings']['hotlink'] = FALSE;
$config['stage_file_proxy.settings']['use_imagecache_root'] = FALSE;
}

// Map API accounts. The value should be a base64 encoded JSON string.
// @see https://github.com/City-of-Helsinki/drupal-module-helfi-api-base/blob/main/documentation/api-accounts.md.
if ($api_accounts = getenv('DRUPAL_API_ACCOUNTS')) {
$config['helfi_api_base.api_accounts']['accounts'] = json_decode(base64_decode($api_accounts), TRUE);
if ($drupal_pubsub_vault = getenv('DRUPAL_PUBSUB_VAULT')) {
$config['helfi_api_base.api_accounts']['vault'][] = [
'id' => 'pubsub',
'plugin' => 'json',
'data' => trim($drupal_pubsub_vault),
];
}

// Map vault accounts. The value should be a base64 encoded JSON string.
// @see https://github.com/City-of-Helsinki/drupal-module-helfi-api-base/blob/main/documentation/api-accounts.md.
if ($vault_accounts = getenv('DRUPAL_VAULT_ACCOUNTS')) {
$config['helfi_api_base.api_accounts']['vault'] = json_decode(base64_decode($vault_accounts), TRUE);
if ($drupal_navigation_vault = getenv('DRUPAL_NAVIGATION_VAULT')) {
$config['helfi_api_base.api_accounts']['vault'][] = [
'id' => 'helfi_navigation',
'plugin' => 'authorization_token',
'data' => trim($drupal_navigation_vault),
];
}

// Override session suffix when present.
Expand Down Expand Up @@ -382,4 +388,3 @@ function drupal_get_env(string|array $variables) : mixed {
if (empty($settings['deployment_identifier'])) {
$settings['deployment_identifier'] = filemtime(__DIR__ . '/../../../composer.lock');
}

0 comments on commit 0a68492

Please sign in to comment.