docs: update documentation for configs (#2819)

This commit is contained in:
Pascal Sthamer 2022-02-07 11:20:53 +01:00 committed by GitHub
parent c1148d4d77
commit dcae6e276b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -679,22 +679,21 @@ export default {
/** /**
* Runtime config allows passing dynamic config and environment variables to the Nuxt app context. * Runtime config allows passing dynamic config and environment variables to the Nuxt app context.
* *
* It is added to the Nuxt payload so there is no need to rebuild to update your configuration in * The value of this object is accessible from server only using `$config` or `useRuntimeConfig`.
* development or if your application is served by the Nuxt server. (For static sites you will still
* need to regenerate your site to see changes.)
*
* The value of this object is accessible from server only using `$config`.
*
* It will override `publicRuntimeConfig` on the server-side. * It will override `publicRuntimeConfig` on the server-side.
* *
* It should hold _private_ environment variables (that should not be exposed on the frontend). * It should hold _private_ environment variables (that should not be exposed on the frontend).
* This could include a reference to your API secret tokens. * This could include a reference to your API secret tokens.
* *
* Values are automatically replaced by matching env variables at runtime, e.g. setting an environment
* variable `API_SECRET=my-api-key` would overwrite the value in the example below.
* Note that the env variable has to be named exactly the same as the config key.
*
* @example * @example
* ```js * ```js
* export default { * export default {
* privateRuntimeConfig: { * privateRuntimeConfig: {
* apiSecret: process.env.API_SECRET * API_SECRET: '' // Default to an empty string, automatically loaded at runtime using process.env.API_SECRET
* } * }
* } * }
* ``` * ```
@ -707,19 +706,20 @@ export default {
/** /**
* Runtime config allows passing dynamic config and environment variables to the Nuxt app context. * Runtime config allows passing dynamic config and environment variables to the Nuxt app context.
* *
* It is added to the Nuxt payload so there is no need to rebuild to update your configuration in * The value of this object is accessible from both client and server using `$config` or `useRuntimeConfig`.
* development or if your application is served by the Nuxt server. (For static sites you will still
* need to regenerate your site to see changes.)
* *
* The value of this object is accessible from both client and server using `$config`. It should hold env * It should hold env variables that are _public_ as they will be accessible on the frontend. This could include a
* variables that are _public_ as they will be accessible on the frontend. This could include a
* reference to your public URL. * reference to your public URL.
* *
* Values are automatically replaced by matching env variables at runtime, e.g. setting an environment
* variable `BASE_URL=https://some-other-url.org` would overwrite the value in the example below.
* Note that the env variable has to be named exactly the same as the config key.
*
* @example * @example
* ```js * ```js
* export default { * export default {
* publicRuntimeConfig: { * publicRuntimeConfig: {
* baseURL: process.env.BASE_URL || 'https://nuxtjs.org' * BASE_URL: 'https://nuxtjs.org'
* } * }
* } * }
* ``` * ```