Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

use sentry config from shared package

Abhinav9ada55b009ee
diff --git a/apps/photos/sentry.client.config.js b/apps/photos/sentry.client.config.js
deleted file mode 100644
index 20b7e9a5de..0000000000
--- a/apps/photos/sentry.client.config.js
+++ /dev/null
@@ -1,53 +0,0 @@
-import * as Sentry from '@sentry/nextjs';
-import { getSentryTunnelURL } from 'utils/common/apiUtil';
-import { getSentryUserID } from 'utils/user';
-import { runningInBrowser } from 'utils/common';
-import { getHasOptedOutOfCrashReports } from 'utils/storage/index';
-import {
- getSentryDSN,
- getSentryENV,
- getSentryRelease,
- getIsSentryEnabled,
-} from 'constants/sentry';
-
-const HAS_OPTED_OUT_OF_CRASH_REPORTING =
- runningInBrowser() && getHasOptedOutOfCrashReports();
-
-if (!HAS_OPTED_OUT_OF_CRASH_REPORTING) {
- const SENTRY_DSN = getSentryDSN();
- const SENTRY_ENV = getSentryENV();
- const SENTRY_RELEASE = getSentryRelease();
- const IS_ENABLED = getIsSentryEnabled();
-
- Sentry.init({
- dsn: SENTRY_DSN,
- enabled: IS_ENABLED,
- environment: SENTRY_ENV,
- release: SENTRY_RELEASE,
- attachStacktrace: true,
- autoSessionTracking: false,
- tunnel: getSentryTunnelURL(),
- beforeSend(event) {
- event.request = event.request || {};
- const currentURL = new URL(document.location.href);
- currentURL.hash = '';
- event.request.url = currentURL;
- return event;
- },
- integrations: function (i) {
- return i.filter(function (i) {
- return i.name !== 'Breadcrumbs';
- });
- },
- // ...
- // Note: if you want to override the automatic release value, do not set a
- // `release` value here - use the environment variable `SENTRY_RELEASE`, so
- // that it will also get attached to your source maps
- });
-
- const main = async () => {
- Sentry.setUser({ id: await getSentryUserID() });
- };
-
- main();
-}
diff --git a/apps/photos/sentry.client.config.ts b/apps/photos/sentry.client.config.ts
new file mode 100644
index 0000000000..bc0f9dae36
--- /dev/null
+++ b/apps/photos/sentry.client.config.ts
@@ -0,0 +1,3 @@
+import { setupSentry } from '@ente/shared/sentry/config/sentry.config.base';
+
+setupSentry();
diff --git a/apps/photos/sentry.server.config.js b/apps/photos/sentry.server.config.js
deleted file mode 100644
index 79b62e6bd7..0000000000
--- a/apps/photos/sentry.server.config.js
+++ /dev/null
@@ -1,28 +0,0 @@
-import * as Sentry from '@sentry/nextjs';
-import {
- getSentryDSN,
- getSentryENV,
- getSentryRelease,
- getIsSentryEnabled,
-} from 'constants/sentry';
-
-import { getSentryUserID } from 'utils/user';
-
-const SENTRY_DSN = getSentryDSN();
-const SENTRY_ENV = getSentryENV();
-const SENTRY_RELEASE = getSentryRelease();
-const IS_ENABLED = getIsSentryEnabled();
-
-Sentry.init({
- dsn: SENTRY_DSN,
- enabled: IS_ENABLED,
- environment: SENTRY_ENV,
- release: SENTRY_RELEASE,
- autoSessionTracking: false,
-});
-
-const main = async () => {
- Sentry.setUser({ id: await getSentryUserID() });
-};
-
-main();
diff --git a/apps/photos/sentry.server.config.ts b/apps/photos/sentry.server.config.ts
new file mode 100644
index 0000000000..bc0f9dae36
--- /dev/null
+++ b/apps/photos/sentry.server.config.ts
@@ -0,0 +1,3 @@
+import { setupSentry } from '@ente/shared/sentry/config/sentry.config.base';
+
+setupSentry();
diff --git a/apps/photos/sentryConfigUtil.js b/apps/photos/sentryConfigUtil.js
deleted file mode 100644
index 84d4a76282..0000000000
--- a/apps/photos/sentryConfigUtil.js
+++ /dev/null
@@ -1,11 +0,0 @@
-const ENV_DEVELOPMENT = 'development';
-
-module.exports.getIsSentryEnabled = () => {
- if (process.env.NEXT_PUBLIC_SENTRY_ENV === ENV_DEVELOPMENT) {
- return false;
- } else if (process.env.NEXT_PUBLIC_DISABLE_SENTRY === 'true') {
- return false;
- } else {
- return true;
- }
-};