Search…
Environment Variable Mappings
Why and how to use environment variable mappings
There a plenty of reasons why you want environment variables in your application. A common one is a backend url for your frontend.
1
export default {
2
API: process.env.REACT_APP_BACKEND_BASE_URL,
3
FRONTEND_URL: process.env.REACT_APP_FRONTEND_BASE_URL
4
};
Copied!
config.js example for a React Application
When you use release we will auto-generated ingress urls for your application that expose ports.
1
- key: BACKEND_INGRESS_URL
2
value: https://api.releaseapp.io
3
- key: FRONTEND_INGRESS_URL
4
value: https://app.releaseapp.io
Copied!
Auto-generated ingress urls
In this case we have the urls used by our frontend application and the ones auto-generated by Release and we want to use those auto-generated ones in our application without changing our application. We do this by mapping the our application envs to the release auto-generated envs, in either our Default Environment Variables or Environment Specific Environment Variables.
1
mapping:
2
REACT_APP_BACKEND_BASE_URL: BACKEND_INGRESS_URL
3
REACT_APP_FRONTEND_BASE_URL: FRONTEND_INGRESS_URL
Copied!
Example of mapping
Your application environment variable is on the left hand side of the ':' and the Release auto-generated env is on the right side. Once you make this change, save and deploy your configuration changes, the value for the Release envs will be mapped to your corresponding envs!
Last modified 7mo ago
Copy link