File tree 6 files changed +13
-6
lines changed
6 files changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ import { HealthcheckModule } from './modules/healthcheck/healthcheck.module';
36
36
// production if a valid DSN is set.
37
37
SentryModule . forRootAsync ( {
38
38
useFactory : async ( config : ConfigService ) => ( {
39
- environment : config . getOrThrow ( 'env' ) ,
39
+ environment : config . getOrThrow ( 'sentry. env' ) ,
40
40
// Whether to enable SentryInterceptor. If enabled, we run a transaction
41
41
// for the lifetime of tracesSampleRate * all HTTP requests. This
42
42
// provides more detailed error
Original file line number Diff line number Diff line change @@ -41,6 +41,7 @@ export interface ConfigInterface {
41
41
enableTracing : boolean ;
42
42
tracesSampleRate : number ;
43
43
tracePrisma : boolean ;
44
+ env : 'production' | 'staging' ;
44
45
} ;
45
46
limits : {
46
47
dailyReports : number ;
Original file line number Diff line number Diff line change @@ -44,7 +44,8 @@ export const ConfigFactory = (): ConfigInterface => {
44
44
dsn : process . env [ 'SENTRY_DSN' ] || '' ,
45
45
enableTracing : process . env [ 'SENTRY_ENABLE_TRACING' ] === 'true' || false ,
46
46
tracesSampleRate : + process . env [ 'SENTRY_TRACE_SAMPLE_RATE' ] || 0 ,
47
- tracePrisma : process . env [ 'SENTRY_TRACE_PRISMA' ] === 'true' || false
47
+ tracePrisma : process . env [ 'SENTRY_TRACE_PRISMA' ] === 'true' || false ,
48
+ env : ( process . env [ 'SENTRY_ENV' ] || '' ) as 'production' | 'staging'
48
49
} ,
49
50
sessionSecret : process . env [ 'SESSION_SECRET' ] || '' ,
50
51
steam : {
Original file line number Diff line number Diff line change @@ -82,6 +82,10 @@ export class ConfigValidation {
82
82
@IsBoolean ( )
83
83
readonly SENTRY_TRACE_PRISMA ?: boolean ;
84
84
85
+ @IsOptional ( )
86
+ @IsIn ( [ 'production' , 'staging' ] )
87
+ readonly SENTRY_ENV ?: 'production' | 'staging' ;
88
+
85
89
@IsUrl ( { require_tld : false , protocols : [ 'postgresql' ] } )
86
90
readonly DATABASE_URL ?: string ;
87
91
Original file line number Diff line number Diff line change @@ -40,8 +40,10 @@ export class SentryModule {
40
40
return false ;
41
41
}
42
42
43
- if ( ! sentryOpts ?. dsn ) {
44
- logger . warn ( 'Sentry DSN not set, not initializing!' ) ;
43
+ if ( ! sentryOpts ?. dsn || ! sentryOpts ?. environment ) {
44
+ logger . warn (
45
+ 'Sentry DSN or environment not set, not initializing!'
46
+ ) ;
45
47
return false ;
46
48
}
47
49
Original file line number Diff line number Diff line change @@ -71,5 +71,4 @@ SENTRY_DSN=
71
71
SENTRY_ENABLE_TRACING=
72
72
SENTRY_TRACE_SAMPLE_RATE=
73
73
SENTRY_TRACE_PRISMA=
74
-
75
-
74
+ SENTRY_ENV=
You can’t perform that action at this time.
0 commit comments