diff --git a/.env.example b/.env.example index eb33fe6e..b698b29f 100644 --- a/.env.example +++ b/.env.example @@ -52,6 +52,8 @@ GLITCHTIP_SECRET_KEY=changeme-generate-a-real-secret SENTRY_DSN= # VITE_SENTRY_DSN: frontend (SvelteKit) — injected at build time via Vite VITE_SENTRY_DSN= +# Sentry/GlitchTip auth token for source map upload at build time (optional) +SENTRY_AUTH_TOKEN= # Production SMTP — uncomment and fill in to send real emails instead of catching them # APP_BASE_URL=https://your-domain.example.com diff --git a/frontend/vite.config.ts b/frontend/vite.config.ts index cdde2860..4c75bc70 100644 --- a/frontend/vite.config.ts +++ b/frontend/vite.config.ts @@ -1,3 +1,4 @@ +import { sentrySvelteKit } from '@sentry/sveltekit'; import { paraglideVitePlugin } from '@inlang/paraglide-js'; import devtoolsJson from 'vite-plugin-devtools-json'; import tailwindcss from '@tailwindcss/vite'; @@ -33,6 +34,21 @@ export default defineConfig({ } }, plugins: [ + sentrySvelteKit({ + org: 'familienarchiv', + project: 'frontend', + authToken: process.env.SENTRY_AUTH_TOKEN, + sentryUrl: (() => { + const dsn = process.env.VITE_SENTRY_DSN; + if (!dsn) return undefined; + try { + return new URL(dsn).origin; + } catch { + return undefined; + } + })(), + autoUploadSourceMaps: !!process.env.SENTRY_AUTH_TOKEN + }), tailwindcss(), sveltekit(), devtoolsJson(),