File tree Expand file tree Collapse file tree 1 file changed +7
-24
lines changed Expand file tree Collapse file tree 1 file changed +7
-24
lines changed Original file line number Diff line number Diff line change @@ -25,30 +25,13 @@ 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 base URLs are available at runtime under ` public.openFetch.[client].baseURL ` .\
31+ You can access and modify them using ` useRuntimeConfig() ` .
32+
33+ You can use this to override url based on environment variables.
2934
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:
5135``` dotenv [.env]
52- NUXT_PUBLIC_OPEN_FETCH_PETS_SCHEMA=https://petstore3.swagger.io/api/v3/openapi.json
53- NUXT_PUBLIC_OPEN_FETCH_PETS_BASE_URL=https://petstore3.swagger.io/api/v3/
36+ NUXT_PUBLIC_OPEN_FETCH_PTES_BASE_URL=https://petstore3.swagger.io/api/v3/
5437```
You can’t perform that action at this time.
0 commit comments