-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Conversation
Made the nuxt.config.ts example using .env, a little more explicit.
β Deploy Preview for nuxt3-docs ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This won't work as written. The point being made above is:
For this to work, you must have a fallback value (which can just be an empty string) defined in your
nuxt.config
.
We're trying to avoid the situation where someone thinks that just because they have apiSecret: process.env.NUXT_API_SECRET
defined in the config, that this will therefore means it gets overriden in production. (It won't work unless NUXT_API_SECRET
is defined at build-time.
Instead, it must be at least: apiSecret: process.env.NUXT_API_SECRET || ''
.
We also want to make it clear that the name of the environment variable is determined by the key within runtimeConfig - e.g. apiSecret
becaomes NUXT_API_SECRET
rather than by the environment variable passed as the default variable.
Any thoughts about how to make the above clearer in the example would be welcome.
We might use comments in the docs after the value: (example) var: '' // Can be overridden by NUXT_APP_VAR environment variable |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's go with @pi0's suggestion, which I think is clearer.
Made the nuxt.config.ts example using .env, a little more explicit.
π Linked issue
β Type of change
π Description
π Checklist