Skip to content

Commit

Permalink
refactor(root): change dsn to be env variable
Browse files Browse the repository at this point in the history
  • Loading branch information
tszhong0411 committed Sep 20, 2024
1 parent 030f849 commit 3d7abdc
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 3 deletions.
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ AUTHOR_EMAIL=
# @see https://sentry.io
# ---------------------------------------------------------------------------------------------------------
SENTRY_AUTH_TOKEN=
NEXT_PUBLIC_SENTRY_DSN=

# ---------------------------------------------------------------------------------------------------------
# Flags
Expand Down
3 changes: 2 additions & 1 deletion apps/web/sentry.client.config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import * as Sentry from '@sentry/nextjs'
import { env } from '@tszhong0411/env'

Sentry.init({
dsn: 'https://6d87aa9808b74c8e5f863310083d49ec@o4504782633631744.ingest.us.sentry.io/4507633355390976',
dsn: env.NEXT_PUBLIC_SENTRY_DSN,
tracesSampleRate: 1,
debug: false,
replaysOnErrorSampleRate: 1,
Expand Down
3 changes: 2 additions & 1 deletion apps/web/sentry.edge.config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import * as Sentry from '@sentry/nextjs'
import { env } from '@tszhong0411/env'

Sentry.init({
dsn: 'https://6d87aa9808b74c8e5f863310083d49ec@o4504782633631744.ingest.us.sentry.io/4507633355390976',
dsn: env.NEXT_PUBLIC_SENTRY_DSN,
tracesSampleRate: 1,
debug: false
})
3 changes: 2 additions & 1 deletion apps/web/sentry.server.config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import * as Sentry from '@sentry/nextjs'
import { env } from '@tszhong0411/env'

Sentry.init({
dsn: 'https://6d87aa9808b74c8e5f863310083d49ec@o4504782633631744.ingest.us.sentry.io/4507633355390976',
dsn: env.NEXT_PUBLIC_SENTRY_DSN,
tracesSampleRate: 1,
debug: false
})
4 changes: 4 additions & 0 deletions packages/env/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ export const env = createEnv({
}
: {}),

NEXT_PUBLIC_SENTRY_DSN: z.string().min(1).url().optional(),

NEXT_PUBLIC_FLAG_COMMENT: z.string().min(1).optional(),
NEXT_PUBLIC_FLAG_AUTH: z.string().min(1).optional(),
NEXT_PUBLIC_FLAG_STATS: z.string().min(1).optional(),
Expand All @@ -90,6 +92,8 @@ export const env = createEnv({
NEXT_PUBLIC_UMAMI_URL: process.env.NEXT_PUBLIC_UMAMI_URL,
NEXT_PUBLIC_UMAMI_WEBSITE_ID: process.env.NEXT_PUBLIC_UMAMI_WEBSITE_ID,

NEXT_PUBLIC_SENTRY_DSN: process.env.NEXT_PUBLIC_SENTRY_DSN,

NEXT_PUBLIC_FLAG_COMMENT: process.env.NEXT_PUBLIC_FLAG_COMMENT,
NEXT_PUBLIC_FLAG_AUTH: process.env.NEXT_PUBLIC_FLAG_AUTH,
NEXT_PUBLIC_FLAG_STATS: process.env.NEXT_PUBLIC_FLAG_STATS,
Expand Down
1 change: 1 addition & 0 deletions turbo.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"RESEND_API_KEY",
"AUTHOR_EMAIL",
"SENTRY_AUTH_TOKEN",
"NEXT_PUBLIC_SENTRY_DSN",
"NEXT_PUBLIC_FLAG_COMMENT",
"NEXT_PUBLIC_FLAG_AUTH",
"NEXT_PUBLIC_FLAG_STATS",
Expand Down

0 comments on commit 3d7abdc

Please sign in to comment.