Skip to main content

Corporate

Env variables

Local development

Most of our apps depend on environment variables for variables that change depending on the environment. As all the apis we are currently using are on the same base url, we have a common environment variable called GATSBY_CCP_API_URL which points to CCP's api gateway.
To be able to run apps locally, you need to define an env.local file in the root directory of the app you are running. The file should contain this variable and any other variables you need.
Example:

GATSBY_CCP_API_URL=https://apix.dev.ccp.tech-03.net/dev

Adding a new env variable

If you are adding a new environment variable which is only used by a single app, include the name of the app in the variable name to avoid the variable clashing with another variable with the same name.
Say you need an endpoint to fetch images from, you would name this variable GATSBY_YOUR_APP_IMAGE_ENDPOINT.
If your app is going to be included in the root app, you will also need to add it to apps/corporate/root-app/deploy/gui-config.yaml for it to be available to the root app when it's built.