Environment Variables
Variable Management
Building on the capability of CNC variables, Coherence adds a UI for team members to easily manage and view variables in environments based on their RBAC permissions.
The UI makes it easy to manage all 4 types of supported variables, at either the Collection
or Environment
level.
The UI offers bulk import options for both Secret
and Standard
variable types, and the Coherence CLI also offers environment variable management capability for scripting.
Environment Inheritance
There are 2 places that you can configure variables in the Coherence UI:
- The "Variables" tab in each
Collection
: these variables will be inherited by all environments in that cloud project (for example the variables in the "Preview" project will be available in all Branch Previews by default) - The
Environment
's Variables tab: these will only apply to the environment they are configured on. You can also override inherited variables using the...
menu
Coherence Managed Variables
In addition to variables you supply, in each environment you can view the cnc
and coherence
provided variables for your app, based on your configuration and settings. These include resource variables like DATABASE_URL
or REDIS_URL
as well as informational variables like CNC_ENVIRONMENT_NAME
. Read more at cnc.
These variables are injected into your app during the build process, and are available in your app at runtime.
'
Build Args for Docker Builds
All environment variables that apply to a service will be added as build-arg
's (docs) to the docker build
command for that service's container.
- As per the docker docs, you'll need to add the
ARG
commands to your dockerfile for them to be made available in your build.