docs: add runtime config section

master
Sébastien Chopin 2020-07-14 12:55:43 +02:00
parent 7000e04990
commit bc6633f39a
2 changed files with 35 additions and 0 deletions

View File

@ -24,6 +24,7 @@ module.exports = {
collapsable: false,
children: [
'/api/',
'/api/runtime-config',
'/api/helpers',
'/api/hooks',
'/api/http-methods'

View File

@ -0,0 +1,34 @@
# Runtime Config
The use of [runtime config](https://nuxtjs.org/guide/runtime-config) is mandatory in case of using environment variables in production. Otherwise, the values will be hard coded during build and won't change until the next build.
Supported options:
- `baseURL`
- `browserBaseURL`
**nuxt.config.js**
```js
export default {
modules: [
'@nuxt/http'
],
http: {
baseURL: 'http://localhost:4000', // Used as fallback if no runtime config is provided
},
publicRuntimeConfig: {
http: {
browserBaseURL: process.env.BROWSER_BASE_URL
}
},
privateRuntimeConfig: {
http: {
baseURL: process.env.BASE_URL
}
}
}
```