Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ jobs:
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
with:
sourcemaps: ./dist/browser
environment: ${{ startsWith(github.ref_name, 'epic/') && 'staging' || 'production' }}
set_commits: skip
- name: Remove source maps
run: find dist/browser -type f -name '*.map' -delete
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "0.0.0",
"private": true,
"scripts": {
"start": "ng serve --proxy-config proxy.conf.js --port 8000",
"start": ". ./.env && ng serve --proxy-config proxy.conf.js --port 8000 --define \"SENTRY_DSN='${SENTRY_DSN}'\"",
"stage": "cross-env NODE_ENV=stage ng serve --proxy-config proxy.conf.js --port 8001 --configuration=stage",
"fix": "npm run i18n:extract && npm run spell:fix && npm run lint:fix && npm run format:fix",
"build": "ng build",
Expand Down
14 changes: 13 additions & 1 deletion src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,14 @@ import { FlexLayoutModule } from 'ng-flex-layout';

import { CommonModule } from '@angular/common';
import { provideHttpClient, withInterceptorsFromDi, withXhr } from '@angular/common/http';
import { LOCALE_ID, NgModule, inject, isDevMode, provideAppInitializer } from '@angular/core';
import {
ErrorHandler,
LOCALE_ID,
NgModule,
inject,
isDevMode,
provideAppInitializer,
} from '@angular/core';
import { MatButtonModule } from '@angular/material/button';
import {
DateAdapter,
Expand All @@ -27,6 +34,7 @@ import { ErrorModule } from '@dsh/app/shared/services';
import { createDateRangeWithPresetSerializer } from '@dsh/components/date-range-filter';
import { BootstrapIconModule, SpinnerModule } from '@dsh/components/indicators';
import { TRANSLOCO_SCOPE, TranslocoModule, provideTransloco } from '@jsverse/transloco';
import * as Sentry from '@sentry/angular';

import { QUERY_PARAMS_SERIALIZERS } from '@vality/matez';

Expand Down Expand Up @@ -73,6 +81,10 @@ import { TranslocoHttpLoaderService } from './transloco-http-loader.service';
],
providers: [
LanguageService,
{
provide: ErrorHandler,
useValue: Sentry.createErrorHandler(),
},
provideAppInitializer(() => {
const initializerFn = initializer(
inject(ConfigService),
Expand Down
32 changes: 21 additions & 11 deletions src/app/initializer.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import * as Sentry from '@sentry/angular';

import { environment } from '../environments';

import { KeycloakService } from './auth/keycloak';
Expand All @@ -19,17 +21,25 @@ export const initializer =
configService.init({ configUrl: environment.appConfigPath }).then(() =>
Promise.all([
themeManager.init(),
keycloakService.init({
config: environment.authConfigPath,
initOptions: {
onLoad: 'login-required',
checkLoginIframe: true,
},
loadUserProfileAtStartUp: true,
enableBearerInterceptor: true,
bearerExcludedUrls: ['/assets'],
bearerPrefix: 'Bearer',
}),
keycloakService
.init({
config: environment.authConfigPath,
initOptions: {
onLoad: 'login-required',
checkLoginIframe: true,
},
loadUserProfileAtStartUp: true,
enableBearerInterceptor: true,
bearerExcludedUrls: ['/assets'],
bearerPrefix: 'Bearer',
})
.then(async () => {
if (SENTRY_DSN) {
const { id, username, email } =
await keycloakService.loadUserProfile();
Sentry.setUser({ id, username, email });
}
}),
]),
),
languageService.init(),
Expand Down
12 changes: 11 additions & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,20 @@ import { environment } from './environments/environment';

if (environment.production) {
enableProdMode();
}

if (SENTRY_DSN) {
Sentry.init({
dsn: SENTRY_DSN,
integrations: [Sentry.browserTracingIntegration(), Sentry.replayIntegration()],
environment: environment.production ? 'production' : 'development',
integrations: [
Sentry.browserTracingIntegration(),
Sentry.replayIntegration({
maskAllText: true,
maskAllInputs: true,
blockAllMedia: true,
}),
],
tracesSampleRate: 1,
replaysSessionSampleRate: 1,
replaysOnErrorSampleRate: 1,
Expand Down
Loading