docs: warn about using differently names env variables (#24612)

This commit is contained in:
Alexander Lichter 2023-12-05 18:47:37 +01:00 committed by GitHub
parent 445fe808c0
commit 64146b4a5d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -56,6 +56,11 @@ There are two key requirements:
1. Only a specially-named environment variable can override a runtime config property. That is, an uppercase environment variable starting with `NUXT_` which uses `_` to separate keys and case changes.
::callout{color="amber" icon="i-ph-warning-duotone"}
Setting the default of `runtimeConfig` values to *differently named environment variables* (for example setting `myVar` to `process.env.OTHER_VARIABLE`) will only work during build-time and will break on runtime.
It is advised to use environment variables that match the structure of your `runtimeConfig` object.
::
#### Example
```sh [.env]