Diizzayy / nuxt-graphql-client

⚡️ Minimal GraphQL Client + Code Generation for Nuxt3
https://nuxt-graphql-client.web.app
MIT License
357 stars 44 forks source link

Allow the host and clientHost to be changed at runtime #482

Open 4ndre4s opened 5 months ago

4ndre4s commented 5 months ago

Your use case

To run the same version of a software on different environments (dev, qa, prod) without rebuilding, it would be very helpful if you could provide the configuration for the host and clientHost at runtime (startup). Currently, this happens at build time.

The solution you'd like

Nuxt offers a way for that: https://nuxt.com/docs/guide/going-further/runtime-config#environment-variables

Instead of reading environment variables at build time, relay on runtimeConfig (by convention) on runtime.

Possible alternatives

No response

Additional information

maybe that is already possible and just not documented?

Diizzayy commented 5 months ago

@4ndre4s This can be achieved via the useGqlHost composable, more information here: https://nuxt-graphql-client.web.app/getting-started/composables#usegqlhost

4ndre4s commented 4 months ago

Thanks for the hint! That does not seem to be the nuxt way, isn't it?