Reference

Environment Variables

There are different kinds of environments that Coherence will execute your application under. It is important to distinguish between them for various purposes such as connecting to a database or generating appropriate URLs within your application (e.g. for the frontend to talk to the API). These environments are:

  • Development (A Workspace/Cloud IDE)
  • CI/CD when building a frontend service's resources
  • CI/CD when executing a service's test command
  • A deployed cloud environment (either a branch preview environment, or a production environment)

In each environment, Coherence auto-populates several environment variables.

  • COHERENCE_DEV will be set to true when running in a Workspace or in CI/CD
  • COHERENCE_TEST will be set to true when running a service's test command in CI/CD
  • COHERENCE_ENVIRONMENT_NAME will be set to the name of the environment in all environments
  • COHERENCE_ENVIRONMENT_DOMAIN will be set to the URL of the running environment in Development and in a deployed cloud environment

Additionally, based on the configuration of your application in coherence.yml, environment variables relevant to accessing these resources are injected into the running application by Coherence. These can be found on the Variables tab of each environment in coherence, and will be in the Auto-generated section:

Within this section the workspace variables will be present in a development environment, and the environment variables will be present in a cloud deployment.

Previous
coherence.yml