VulcanJS / vulcan-next

The Next starter for GraphQL developers
http://vulcan-docs.vercel.app
MIT License
393 stars 29 forks source link

Investigate react-env for runtime .env switch #126

Open eric-burel opened 3 years ago

eric-burel commented 3 years ago

Is your feature request related to a problem? Please describe. Next.js will bake NEXTPUBLIC* client variables at build time. So you cannot change those variables at runtime.

react-env brings the possibility of loading the variables at runtime instead. It's great for easy switch between different environment during development, or changing the route of an API. You just nee to restart the server, instead of building it.

This way, the client app behaviour is closer to the server behaviour regarding env variable: you simply need to restart to apply the change, instead of rebuilding. This is in particular less confusing for devops, that have the habit of just restarting the app to apply changes.

Describe alternatives you've considered Node-config does something similar with JSON files => it would be closer to what exists in Meteor React-env is closer to what exists in Next.js (env based configuration)