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:
@ -9,4 +9,4 @@ rm -rf "./$BASE_FILENAME"
|
||||
echo "window._env_ = {"
|
||||
echo " REACT_APP_SERVER_BASE_URL: \"$REACT_APP_SERVER_BASE_URL\","
|
||||
echo "}"
|
||||
} > "./$BASE_FILENAME"
|
||||
} > "./$BASE_FILENAME"
|
||||
|
||||
@ -803,6 +803,8 @@ export enum RemoteTableStatus {
|
||||
export type Sentry = {
|
||||
__typename?: 'Sentry';
|
||||
dsn?: Maybe<Scalars['String']['output']>;
|
||||
environment?: Maybe<Scalars['String']['output']>;
|
||||
release?: Maybe<Scalars['String']['output']>;
|
||||
};
|
||||
|
||||
export type SessionEntity = {
|
||||
|
||||
@ -575,6 +575,8 @@ export enum RemoteTableStatus {
|
||||
export type Sentry = {
|
||||
__typename?: 'Sentry';
|
||||
dsn?: Maybe<Scalars['String']>;
|
||||
environment?: Maybe<Scalars['String']>;
|
||||
release?: Maybe<Scalars['String']>;
|
||||
};
|
||||
|
||||
export type SessionEntity = {
|
||||
@ -1107,7 +1109,7 @@ export type UpdateBillingSubscriptionMutation = { __typename?: 'Mutation', updat
|
||||
export type GetClientConfigQueryVariables = Exact<{ [key: string]: never; }>;
|
||||
|
||||
|
||||
export type GetClientConfigQuery = { __typename?: 'Query', clientConfig: { __typename?: 'ClientConfig', signInPrefilled: boolean, signUpDisabled: boolean, debugMode: boolean, authProviders: { __typename?: 'AuthProviders', google: boolean, password: boolean }, billing: { __typename?: 'Billing', isBillingEnabled: boolean, billingUrl?: string | null, billingFreeTrialDurationInDays?: number | null }, telemetry: { __typename?: 'Telemetry', enabled: boolean, anonymizationEnabled: boolean }, support: { __typename?: 'Support', supportDriver: string, supportFrontChatId?: string | null }, sentry: { __typename?: 'Sentry', dsn?: string | null } } };
|
||||
export type GetClientConfigQuery = { __typename?: 'Query', clientConfig: { __typename?: 'ClientConfig', signInPrefilled: boolean, signUpDisabled: boolean, debugMode: boolean, authProviders: { __typename?: 'AuthProviders', google: boolean, password: boolean }, billing: { __typename?: 'Billing', isBillingEnabled: boolean, billingUrl?: string | null, billingFreeTrialDurationInDays?: number | null }, telemetry: { __typename?: 'Telemetry', enabled: boolean, anonymizationEnabled: boolean }, support: { __typename?: 'Support', supportDriver: string, supportFrontChatId?: string | null }, sentry: { __typename?: 'Sentry', dsn?: string | null, environment?: string | null, release?: string | null } } };
|
||||
|
||||
export type UploadFileMutationVariables = Exact<{
|
||||
file: Scalars['Upload'];
|
||||
@ -2150,6 +2152,8 @@ export const GetClientConfigDocument = gql`
|
||||
}
|
||||
sentry {
|
||||
dsn
|
||||
environment
|
||||
release
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -51,6 +51,8 @@ export const ClientConfigProviderEffect = () => {
|
||||
|
||||
setSentryConfig({
|
||||
dsn: data?.clientConfig?.sentry?.dsn,
|
||||
release: data?.clientConfig?.sentry?.release,
|
||||
environment: data?.clientConfig?.sentry?.environment,
|
||||
});
|
||||
}
|
||||
}, [
|
||||
|
||||
@ -25,6 +25,8 @@ export const GET_CLIENT_CONFIG = gql`
|
||||
}
|
||||
sentry {
|
||||
dsn
|
||||
environment
|
||||
release
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -22,6 +22,8 @@ export const SentryInitEffect = () => {
|
||||
useEffect(() => {
|
||||
if (isNonEmptyString(sentryConfig?.dsn) && !isSentryInitialized) {
|
||||
Sentry.init({
|
||||
environment: sentryConfig?.environment ?? undefined,
|
||||
release: sentryConfig?.release ?? undefined,
|
||||
dsn: sentryConfig?.dsn,
|
||||
integrations: [
|
||||
new Sentry.BrowserTracing({
|
||||
|
||||
@ -13,7 +13,7 @@ export default defineConfig(({ command, mode }) => {
|
||||
/*
|
||||
Using explicit env variables, there is no need to expose all of them (security).
|
||||
*/
|
||||
const { REACT_APP_SERVER_BASE_URL } = env;
|
||||
const { REACT_APP_SERVER_BASE_URL, SENTRY_RELEASE, ENVIRONMENT } = env;
|
||||
|
||||
const isBuildCommand = command === 'build';
|
||||
|
||||
@ -62,6 +62,8 @@ export default defineConfig(({ command, mode }) => {
|
||||
define: {
|
||||
'process.env': {
|
||||
REACT_APP_SERVER_BASE_URL,
|
||||
SENTRY_RELEASE,
|
||||
ENVIRONMENT,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user