runtime environment variables with app router
I am currently tasked with preparing our application to run in multiple deployments on different servers ran on locally which means they will need their own set of environment variables set at either runtime or build time. The issue that my team is facing is that with going with a build time set of environment variables, we no longer will have a single source of truth for our production app because there will be too many versions of it due to a singular environment variable being their local IP address. Our team is using the app router, and we came across this statement in the documentation of using getServerSide props to load in the dynamic variable, but none of us have no idea what that means. I've also seen the runtimeConfig variables, but that apparently does not work with the app router.
My question is, is how would we be able to natively build once run anywhere and inject this variable at runtime, without adding another solution like s3 buckets to inject them in that way. Is there even a solution to this?
0 Replies