Skip to content

Commit

Permalink
Get env from context
Browse files Browse the repository at this point in the history
  • Loading branch information
razzeee committed Apr 15, 2024
1 parent 08faece commit 1888a9e
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions backend-node/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import DeveloperInviteAcceptedEmail from "../emails/developer-invite-accepted"
import DeveloperInviteEmail from "../emails/developer-invite"
import { logger } from "hono/logger"
import { sentry } from "@hono/sentry"
import { env } from "hono/adapter"

const RequestSchema = z.object({
requestType: z.literal("appdata"),
Expand Down Expand Up @@ -191,14 +192,14 @@ const route = createRoute({
})
const app = new OpenAPIHono()

app.use(
"*",
sentry({
dsn: process.env.SENTRY_DSN,
app.use("*", (c, next) => {
const { SENTRY_DSN } = env<{ SENTRY_DSN: string }>(c)
return sentry({
dsn: SENTRY_DSN,
sampleRate: 0.1,
tracesSampleRate: 0.1,
}),
)
})(c, next)
})
app.use(logger())

app.openapi(route, async (c) => {
Expand Down

0 comments on commit 1888a9e

Please sign in to comment.