Environment variables
You can configure the agent with any of the supported properties through environment variables.
The environment variables need to be set before the agent starts up, and in a location where the agent has access to it. Environment variables can be set within the same process or system-wide.
Important
If you set system-wide environment variables, this may impact other Contrast agents running on the same server.
You can convert any Contrast property between command line, YAML and an environment variable.
To convert a command line formatted variable to an environment variable, replace the path segment delimiters (.) with double underscores (__).
To convert a YAML formatted variable to an environment variable, start with the top-level property and separate every nested property with a double underscore (__).
Then, prepend the "contrast" namespace (either contrast.
or CONTRAST__
).
Environment variables should be in all caps and have no spaces.
For example:
Command line | YAML property | Environment variable |
---|---|---|
contrast.server.name | server: name: | CONTRAST__SERVER__NAME |
contrast.api.api_key | api: api_key: | CONTRAST__API__API_KEY |
You can see a list of all supported properties for each agent in their respective YAML templates:
See also
Additional configuration for more details about the environment variables used for configuration.