@@ -24,7 +24,7 @@ if (!process.env.BFF_SENTRY_DSN || process.env.BFF_SENTRY_DSN.trim() === '') {
2424} else {
2525 Sentry . init ( {
2626 dsn : process . env . BFF_SENTRY_DSN ,
27- environment : process . env . VITE_SENTRY_ENVIRONMENT ,
27+ environment : process . env . FRONTEND_SENTRY_ENVIRONMENT ,
2828 beforeSend ( event ) {
2929 if ( event . request && event . request . cookies ) {
3030 event . request . cookies = Object . keys ( event . request . cookies ) . reduce ( ( acc , key ) => {
@@ -72,12 +72,12 @@ await fastify.register(envPlugin);
7272
7373let sentryHost = '' ;
7474// @ts -ignore
75- if ( fastify . config . VITE_SENTRY_DSN && fastify . config . VITE_SENTRY_DSN . length > 0 ) {
75+ if ( fastify . config . FRONTEND_SENTRY_DSN && fastify . config . FRONTEND_SENTRY_DSN . length > 0 ) {
7676 try {
7777 // @ts -ignore
78- sentryHost = new URL ( fastify . config . VITE_SENTRY_DSN ) . hostname ;
78+ sentryHost = new URL ( fastify . config . FRONTEND_SENTRY_DSN ) . hostname ;
7979 } catch {
80- console . log ( 'VITE_SENTRY_DSN is not a valid URL' ) ;
80+ console . log ( 'FRONTEND_SENTRY_DSN is not a valid URL' ) ;
8181 sentryHost = '' ;
8282 }
8383}
@@ -95,7 +95,9 @@ fastify.register(helmet, {
9595 contentSecurityPolicy : {
9696 directives : {
9797 'connect-src' : [ "'self'" , 'sdk.openui5.org' , sentryHost , dynatraceOrigin ] ,
98- 'script-src' : isLocalDev ? [ "'self'" , "'unsafe-inline'" , dynatraceOrigin ] : [ "'self'" , dynatraceOrigin ] ,
98+ 'script-src' : isLocalDev
99+ ? [ "'self'" , "'unsafe-inline'" , "'unsafe-eval'" , sentryHost , dynatraceOrigin ]
100+ : [ "'self'" , sentryHost , dynatraceOrigin ] ,
99101 // @ts -ignore
100102 'frame-ancestors' : [ ...fastify . config . FRAME_ANCESTORS . split ( ',' ) ] ,
101103 } ,
@@ -112,6 +114,15 @@ await fastify.register(FastifyVite, {
112114 spa : true ,
113115} ) ;
114116
117+ fastify . get ( '/sentry' , function ( req , reply ) {
118+ return reply . send ( {
119+ // @ts -ignore
120+ FRONTEND_SENTRY_DSN : fastify . config . FRONTEND_SENTRY_DSN ,
121+ // @ts -ignore
122+ FRONTEND_SENTRY_ENVIRONMENT : fastify . config . FRONTEND_SENTRY_ENVIRONMENT ,
123+ } ) ;
124+ } ) ;
125+
115126// @ts -ignore
116127fastify . get ( '/' , function ( req , reply ) {
117128 return reply . html ( ) ;
0 commit comments