Skip to content

Commit

Permalink
UHF-9982: Overwrite sentry DSN for js tracking
Browse files Browse the repository at this point in the history
  • Loading branch information
hyrsky committed Oct 17, 2024
1 parent 7a37870 commit 23c0816
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions helfi_api_base.module
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

declare(strict_types=1);

use Drupal\Core\Asset\AttachedAssetsInterface;
use Drupal\Core\Entity\EntityInterface;
use Drupal\Core\Language\LanguageInterface;
use Drupal\helfi_api_base\Features\FeatureManager;
Expand Down Expand Up @@ -123,3 +124,14 @@ function helfi_api_base_template_preprocess_default_variables_alter(array &$vari
$variables['lang_attributes']['fallback_dir'] = $attributes['dir'];
}
}

/**
* Implements hook_js_settings_alter().
*/
function helfi_api_base_js_settings_alter(array &$settings, AttachedAssetsInterface $assets): void {
// Raven sets DSN from SENTRY_DNS environment variable, which we use for
// PHP tracking.
if (isset($settings['raven']['options']['dsn'])) {
$settings['raven']['options']['dsn'] = getenv('SENTRY_DNS_PUBLIC');
}
}

0 comments on commit 23c0816

Please sign in to comment.