Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
Tracked by #9095
s1gr1d opened this issue Aug 13, 2024 · 2 comments · Fixed by #13457
Closed
Tracked by #9095

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

s1gr1d opened this issue Aug 13, 2024 · 2 comments · Fixed by #13457
Labels
Package: nuxt Issues related to the Sentry Nuxt SDK

Comments

@s1gr1d
Copy link
Member

s1gr1d commented Aug 13, 2024

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

@s1gr1d s1gr1d added the Package: nuxt Issues related to the Sentry Nuxt SDK label Aug 13, 2024
@s1gr1d s1gr1d mentioned this issue Aug 13, 2024
@lud-hu
Copy link

lud-hu commented Sep 4, 2024

I guess this was implemented in #13457 ?

@s1gr1d
Copy link
Member Author

s1gr1d commented Sep 5, 2024

Yes, this was implemented, but this only works on client-side due to technical reasons.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Package: nuxt Issues related to the Sentry Nuxt SDK
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants