Why I need to add server env variables to runtimeConfig?
Could someone explain me why I need to add
API_ROUTE_SECRET
inside runtimeConfig?
Since is only server-side I can simply access it like process.env.API_ROUTE_SECRET
Why would I add it also here?3 Replies
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
for some reason it was not working until i prefixed the env variables with
NUXT_PUBLIC_
https://nuxt.com/docs/guide/going-further/runtime-config#environment-variablesNuxt
Runtime Config · Nuxt Advanced
Nuxt provides a runtime config API to expose configuration within your application.
Yeah, I've been wondering the same forever. I never add them and simply use them in my server routes as
process.env.x
never had an issue
Doesn't make sense IMO to add them