feat: add SENTRY_RELEASE env (#4912)
Add support for a new SENTRY_RELEASE and SENTRY_ENVIRONMENT env. It is optional and allows to init sentry with a Release version and an env (used internally at Twenty). Docker image have been updated do intergrate the new env as an Argument
This commit is contained in:
@ -44,6 +44,12 @@ class Support {
|
||||
|
||||
@ObjectType()
|
||||
class Sentry {
|
||||
@Field(() => String, { nullable: true })
|
||||
environment?: string;
|
||||
|
||||
@Field(() => String, { nullable: true })
|
||||
release?: string;
|
||||
|
||||
@Field(() => String, { nullable: true })
|
||||
dsn?: string;
|
||||
}
|
||||
|
||||
@ -39,7 +39,9 @@ export class ClientConfigResolver {
|
||||
),
|
||||
},
|
||||
sentry: {
|
||||
dsn: this.environmentService.get('SENTRY_DSN'),
|
||||
environment: this.environmentService.get('SENTRY_ENVIRONMENT'),
|
||||
release: this.environmentService.get('SENTRY_RELEASE'),
|
||||
dsn: this.environmentService.get('SENTRY_DSN_FRONT'),
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
@ -231,6 +231,26 @@ export class EnvironmentVariables {
|
||||
@IsString()
|
||||
SENTRY_DSN: string;
|
||||
|
||||
@ValidateIf(
|
||||
(env) => env.EXCEPTION_HANDLER_DRIVER === ExceptionHandlerDriver.Sentry,
|
||||
)
|
||||
@IsString()
|
||||
SENTRY_DSN_FRONT: string;
|
||||
|
||||
@ValidateIf(
|
||||
(env) => env.EXCEPTION_HANDLER_DRIVER === ExceptionHandlerDriver.Sentry,
|
||||
)
|
||||
@IsString()
|
||||
@IsOptional()
|
||||
SENTRY_RELEASE: string;
|
||||
|
||||
@ValidateIf(
|
||||
(env) => env.EXCEPTION_HANDLER_DRIVER === ExceptionHandlerDriver.Sentry,
|
||||
)
|
||||
@IsString()
|
||||
@IsOptional()
|
||||
SENTRY_ENVIRONMENT: string;
|
||||
|
||||
@IsDuration()
|
||||
@IsOptional()
|
||||
PASSWORD_RESET_TOKEN_EXPIRES_IN: string = '5m';
|
||||
|
||||
@ -14,6 +14,7 @@ export class ExceptionHandlerSentryDriver
|
||||
{
|
||||
constructor(options: ExceptionHandlerSentryDriverFactoryOptions['options']) {
|
||||
Sentry.init({
|
||||
release: options.release,
|
||||
dsn: options.dsn,
|
||||
integrations: [
|
||||
new Sentry.Integrations.Http({ tracing: true }),
|
||||
|
||||
@ -25,6 +25,8 @@ export const exceptionHandlerModuleFactory = async (
|
||||
return {
|
||||
type: ExceptionHandlerDriver.Sentry,
|
||||
options: {
|
||||
environment: environmentService.get('SENTRY_ENVIRONMENT'),
|
||||
release: environmentService.get('SENTRY_RELEASE'),
|
||||
dsn: environmentService.get('SENTRY_DSN') ?? '',
|
||||
serverInstance: adapterHost.httpAdapter?.getInstance(),
|
||||
debug: environmentService.get('DEBUG_MODE'),
|
||||
|
||||
@ -8,6 +8,8 @@ export enum ExceptionHandlerDriver {
|
||||
export interface ExceptionHandlerSentryDriverFactoryOptions {
|
||||
type: ExceptionHandlerDriver.Sentry;
|
||||
options: {
|
||||
environment?: string;
|
||||
release?: string;
|
||||
dsn: string;
|
||||
serverInstance?: Router;
|
||||
debug?: boolean;
|
||||
|
||||
Reference in New Issue
Block a user