1

Hi is possible set env on runtime? We have case that we want to build docker image and run it multiple times with different env. I found in documentation that env need to be set on build. Is any solution for that?

Thank you for your help

d3tr1tus
  • 789
  • 2
  • 10
  • 23
  • It's kind of a problematic topic with js frameworks, usually, a workaround depending on the usage is implemented. for what is the `env` used? – Noam Yizraeli Oct 27 '21 at 09:24
  • @NoamYizraeli the `env` is used for API url for backend – d3tr1tus Oct 27 '21 at 12:05
  • I've had a similar issue in react which was solved by rerouting backend API requests using nginx and setting the different URLs with nginx runtime environment variables. see if [this post](https://stackoverflow.com/questions/55504509/nginx-not-routing-calls-from-react-app-to-backend-app) can help you – Noam Yizraeli Oct 27 '21 at 12:22
  • @NoamYizraeli thank you for your help. Is there any solution workaround just with Next.js? – d3tr1tus Nov 02 '21 at 11:58
  • sorry, just realized Nginx is not relevant for next.js since it doesn't work as server-side rendering. not much but still an important pointer, you should look for a web server to serve the pages like `node` but be able to take runtime environment variables or configs. will check but no promises – Noam Yizraeli Nov 02 '21 at 19:19

0 Answers0