File tree Expand file tree Collapse file tree 1 file changed +9
-23
lines changed Expand file tree Collapse file tree 1 file changed +9
-23
lines changed Original file line number Diff line number Diff line change @@ -25,30 +25,16 @@ export default defineNuxtConfig({
2525| ` clients.[client].query ` | ` SearchParameters ` | | Adds query search params to URL |
2626| ` clients.[client].schema ` | ` OpenAPI3Schema ` | | Local or remote schema file (YAML or JSON) |
2727
28- Client can also be configured using ` runtimeConfig ` or environment variables:
28+ ## Runtime configuration
29+
30+ All options, except ` schema ` , are automatically copied to the runtime config.
31+
32+ :: note
33+ You can access and modify these options at runtime using [ ` useRuntimeConfig() ` ] ( https://nuxt.com/docs/4.x/api/composables/use-runtime-config ) .
34+ ::
35+
36+ This is particularly useful for overriding settings with ** environment variables** . For example:
2937
30- ``` ts twoslash [nuxt.config.ts]
31- // @noErrors
32- export default defineNuxtConfig ({
33- openFetch: {
34- clients: {
35- pets: {} // The key should be specified as it is used to generate the client
36- }
37- },
38- runtimeConfig: {
39- public: {
40- openFetch: {
41- pets: {
42- schema: ' https://petstore3.swagger.io/api/v3/openapi.json' ,
43- baseURL: ' https://petstore3.swagger.io/api/v3/'
44- },
45- },
46- }
47- },
48- })
49- ```
50- or:
5138``` dotenv [.env]
52- NUXT_PUBLIC_OPEN_FETCH_PETS_SCHEMA=https://petstore3.swagger.io/api/v3/openapi.json
5339NUXT_PUBLIC_OPEN_FETCH_PETS_BASE_URL=https://petstore3.swagger.io/api/v3/
5440```
You can’t perform that action at this time.
0 commit comments