Skip to content

Nuxt (optional): Make it possible to use runtime config in external file #13341

@s1gr1d

Description

@s1gr1d

Would be great if, within the sentry.client.config.ts file, we would able to use the runtime config:

https://nuxt.com/docs/api/composables/use-runtime-config

Example from other module:
https://formkit.com/getting-started/installation#using-environment-variables-in-formkitconfigts

The code below

import * as Sentry from '@sentry/nuxt'

Sentry.init({
  enabled: process.env.NUXT_PUBLIC_SENTRY_ENABLED,
})

Would then become:

import * as Sentry from '@sentry/nuxt'

export default defineSentryConfig(() => {

  const config = useRuntimeConfig()

  Sentry.init({
    enabled: config.public.sentry.enabled,
  })
})

Originally posted by @darthf1 in #9095

Metadata

Metadata

Assignees

No one assigned

    Labels

    Package: nuxtIssues related to the Sentry Nuxt SDK

    Projects

    Status

    Waiting for: Product Owner

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions