Override the `API_ROOT` in production builds using environment variables
simbo1905 opened this issue · 0 comments
The readme says to edit the src/agent.js
to change the API_ROOT
to point to a different backend api instance. We want to set things up so that API_ROOT
can be defined by an environment variable that is different for the multiple environments(e.g., “staging” and “live”) where we run the production build.
We are running in containers on openshift kubernetes following 12factor.net principles where the code is built once then promoted through environments. We can spin up new new environments with a single command so we don’t want to have a switch statement within the code that names each environment and hardcodes the backend API_ROOT
for each environment. Instead I want to be able to run an existing production build container image in a fresh environment where I have change the API_ROOT
to point to the correct backend API that has the data we want to test against.
I have asked about the best way to do this on stackoverflow.com at https://stackoverflow.com/q/49975735/329496