mirror of
https://github.com/nuxt/nuxt.git
synced 2025-01-18 01:15:58 +00:00
docs: update documentation for configs (#2819)
This commit is contained in:
parent
c1148d4d77
commit
dcae6e276b
@ -678,23 +678,22 @@ export default {
|
||||
|
||||
/**
|
||||
* 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
|
||||
* 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`.
|
||||
*
|
||||
*
|
||||
* The value of this object is accessible from server only using `$config` or `useRuntimeConfig`.
|
||||
* It will override `publicRuntimeConfig` on the server-side.
|
||||
*
|
||||
* It should hold _private_ environment variables (that should not be exposed on the frontend).
|
||||
* 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
|
||||
* ```js
|
||||
* export default {
|
||||
* privateRuntimeConfig: {
|
||||
* apiSecret: process.env.API_SECRET
|
||||
* API_SECRET: '' // Default to an empty string, automatically loaded at runtime using process.env.API_SECRET
|
||||
* }
|
||||
* }
|
||||
* ```
|
||||
@ -706,20 +705,21 @@ export default {
|
||||
|
||||
/**
|
||||
* 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
|
||||
* 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
|
||||
* variables that are _public_ as they will be accessible on the frontend. This could include a
|
||||
*
|
||||
* The value of this object is accessible from both client and server using `$config` or `useRuntimeConfig`.
|
||||
*
|
||||
* It should hold env variables that are _public_ as they will be accessible on the frontend. This could include a
|
||||
* 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
|
||||
* ```js
|
||||
* export default {
|
||||
* publicRuntimeConfig: {
|
||||
* baseURL: process.env.BASE_URL || 'https://nuxtjs.org'
|
||||
* BASE_URL: 'https://nuxtjs.org'
|
||||
* }
|
||||
* }
|
||||
* ```
|
||||
|
Loading…
Reference in New Issue
Block a user