vulcan-next icon indicating copy to clipboard operation
vulcan-next copied to clipboard

Clarify how to handle dynamic config

Open eric-burel opened this issue 4 years ago • 2 comments

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

eric-burel avatar Jun 18 '20 09:06 eric-burel

Related to #62

eric-burel avatar Oct 12 '20 13:10 eric-burel

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.

eric-burel avatar May 11 '21 15:05 eric-burel