vulcan-next
vulcan-next copied to clipboard
Clarify how to handle dynamic config
See https://github.com/vercel/next.js/discussions/14308
Runtime configs are not advised, because they can't be deployed in a serverless environment. However, environment variable are clearly not sufficient to setup the app: how to parse arrays, how to dynamically set a value? If only because they are string based, and not very intuitive to consume.
See src/lib/api/cors for instance:
- we can't easily tell that cors can be set using APOLLO_SERVER_CORS_WHITELIST
- we need to parse it, since its not an array but a string
- no nesting, so except dirty names with long prefixes
Related to #62
Wrote an article about this subject: https://blog.vulcanjs.org/how-to-set-configuration-variables-in-next-js-a81505e43dad Assigned to myself until I can reproduce the same setup as in Aplines: ability to check environment variables presence + the best possible setup for dynamic config. #62 is still relevant as well, to avoid relying too much on env variables, but it's farther away from Next behaviour.