mirror of
https://github.com/meienberger/runtipi.git
synced 2024-10-03 23:28:33 +03:00
84ea5dcb7f
* chore: bump version to 3.5.2 * fix(container): use env variables instead of parsing before ready * chore: run biome safe autofix * fix(db): use env for username and db instead of hardcoded value
30 lines
861 B
TypeScript
30 lines
861 B
TypeScript
import { cleanseErrorData, settingsSchema } from '@runtipi/shared';
|
|
import * as Sentry from '@sentry/nextjs';
|
|
|
|
const getClientConfig = () => {
|
|
if (typeof window === 'undefined') {
|
|
return {};
|
|
}
|
|
|
|
const inputElement = document.getElementById('client-settings') as HTMLInputElement | null;
|
|
|
|
if (!inputElement) {
|
|
return {};
|
|
}
|
|
|
|
const parsedSettings = settingsSchema.parse(JSON.parse(inputElement.value));
|
|
|
|
return parsedSettings;
|
|
};
|
|
|
|
const { allowErrorMonitoring } = getClientConfig();
|
|
|
|
if (allowErrorMonitoring && process.env.NODE_ENV === 'production' && process.env.LOCAL !== 'true') {
|
|
Sentry.init({
|
|
environment: process.env.NODE_ENV,
|
|
dsn: 'https://7a73d72f886948478b55621e7b92c3c7@o4504242900238336.ingest.sentry.io/4504826587971584',
|
|
beforeSend: cleanseErrorData,
|
|
integrations: [Sentry.extraErrorDataIntegration()],
|
|
});
|
|
}
|