feat: specify env for sentry
This commit is contained in:
parent
16384e8804
commit
9acae8893d
|
|
@ -43,6 +43,7 @@ export default async function AppLayout({ children }: { children: ReactNode }) {
|
|||
storageProvider={
|
||||
process.env.STORAGE_PROVIDER! as 'local' | 'cloudflare'
|
||||
}
|
||||
environment={process.env.NODE_ENV!}
|
||||
backendUrl={process.env.NEXT_PUBLIC_BACKEND_URL!}
|
||||
plontoKey={process.env.NEXT_PUBLIC_POLOTNO!}
|
||||
billingEnabled={!!process.env.STRIPE_PUBLISHABLE_KEY}
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ export default async function AppLayout({ children }: { children: ReactNode }) {
|
|||
storageProvider={
|
||||
process.env.STORAGE_PROVIDER! as 'local' | 'cloudflare'
|
||||
}
|
||||
environment={process.env.NODE_ENV!}
|
||||
backendUrl={process.env.NEXT_PUBLIC_BACKEND_URL!}
|
||||
plontoKey={process.env.NEXT_PUBLIC_POLOTNO!}
|
||||
billingEnabled={!!process.env.STRIPE_PUBLISHABLE_KEY}
|
||||
|
|
|
|||
|
|
@ -5,14 +5,14 @@ import { useVariables } from '@gitroom/react/helpers/variable.context';
|
|||
import { initializeSentryClient } from '@gitroom/react/sentry/initialize.sentry.client';
|
||||
|
||||
export const SentryComponent: FC<{ children: ReactNode }> = ({ children }) => {
|
||||
const { sentryDsn: dsn } = useVariables();
|
||||
const { sentryDsn: dsn, environment } = useVariables();
|
||||
|
||||
useEffect(() => {
|
||||
if (!dsn) {
|
||||
return;
|
||||
}
|
||||
|
||||
initializeSentryClient(dsn);
|
||||
initializeSentryClient(environment, dsn);
|
||||
}, [dsn]);
|
||||
|
||||
// Always render children - don't block the app
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
import { initializeSentryServer } from '@gitroom/react/sentry/initialize.sentry.server';
|
||||
|
||||
initializeSentryServer(process.env.NEXT_PUBLIC_SENTRY_DSN);
|
||||
initializeSentryServer(process.env.NODE_ENV, process.env.NEXT_PUBLIC_SENTRY_DSN);
|
||||
|
|
@ -1,3 +1,3 @@
|
|||
import { initializeSentryServer } from '@gitroom/react/sentry/initialize.sentry.server';
|
||||
|
||||
initializeSentryServer(process.env.NEXT_PUBLIC_SENTRY_DSN);
|
||||
initializeSentryServer(process.env.NODE_ENV!, process.env.NEXT_PUBLIC_SENTRY_DSN!);
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ interface VariableContextInterface {
|
|||
plontoKey: string;
|
||||
storageProvider: 'local' | 'cloudflare';
|
||||
backendUrl: string;
|
||||
environment: string;
|
||||
discordUrl: string;
|
||||
uploadDirectory: string;
|
||||
facebookPixel: string;
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
import * as Sentry from '@sentry/nextjs';
|
||||
import { initializeSentryBasic } from '@gitroom/react/sentry/initialize.sentry.next.basic';
|
||||
|
||||
export const initializeSentryClient = (dsn: string) =>
|
||||
initializeSentryBasic(dsn, {
|
||||
export const initializeSentryClient = (environment: string, dsn: string) =>
|
||||
initializeSentryBasic(environment, dsn, {
|
||||
integrations: [
|
||||
// Add default integrations back
|
||||
Sentry.browserTracingIntegration(),
|
||||
|
|
@ -12,7 +12,7 @@ export const initializeSentryClient = (dsn: string) =>
|
|||
}),
|
||||
],
|
||||
replaysSessionSampleRate:
|
||||
process.env.NODE_ENV === 'development' ? 1.0 : 0.1,
|
||||
environment === 'development' ? 1.0 : 0.1,
|
||||
replaysOnErrorSampleRate:
|
||||
process.env.NODE_ENV === 'development' ? 1.0 : 0.1,
|
||||
environment === 'development' ? 1.0 : 0.1,
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import * as Sentry from '@sentry/nextjs';
|
||||
|
||||
export const initializeSentryBasic = (dsn: string, extension: any) => {
|
||||
export const initializeSentryBasic = (environment: string, dsn: string, extension: any) => {
|
||||
if (!dsn) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -20,11 +20,12 @@ export const initializeSentryBasic = (dsn: string, extension: any) => {
|
|||
},
|
||||
},
|
||||
},
|
||||
environment,
|
||||
dsn,
|
||||
sendDefaultPii: true,
|
||||
...extension,
|
||||
debug: process.env.NODE_ENV === 'development',
|
||||
tracesSampleRate: process.env.NODE_ENV === 'development' ? 1.0 : 0.3,
|
||||
debug: environment === 'development',
|
||||
tracesSampleRate: environment === 'development' ? 1.0 : 0.3,
|
||||
});
|
||||
} catch (err) {}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import * as Sentry from '@sentry/nextjs';
|
||||
import { initializeSentryBasic } from '@gitroom/react/sentry/initialize.sentry.next.basic';
|
||||
|
||||
export const initializeSentryServer = (dsn: string) =>
|
||||
initializeSentryBasic(dsn, {});
|
||||
export const initializeSentryServer = (environment: string, dsn: string) =>
|
||||
initializeSentryBasic(environment, dsn, {});
|
||||
|
|
|
|||
Loading…
Reference in New Issue