/**
 * Sentry (Glitchtip-compatible) server-side init.
 *
 * DSN must point to Glitchtip — we never send to sentry.io. See
 * SENTRY_DSN / NEXT_PUBLIC_SENTRY_DSN in docker-compose.yml. If unset, the SDK
 * is loaded but no events ship — safe for local dev.
 */
import * as Sentry from "@sentry/nextjs";

const dsn = process.env.SENTRY_DSN || process.env.NEXT_PUBLIC_SENTRY_DSN;
if (dsn) {
  Sentry.init({
    dsn,
    environment: process.env.NODE_ENV || "development",
    release: process.env.SENTRY_RELEASE,
    tracesSampleRate: 0,  // Glitchtip community doesn't support performance traces
    sendDefaultPii: false,
    // Make sure events land on Glitchtip's tunnel-friendly DSN host, not
    // sentry.io. The SDK already infers from DSN; this is just defensive.
  });
}
