Skip to main content

YAML configuration

You can use a YAML configuration file to set configuration properties for your agent. These values can be overridden with environment variables or command line arguments.

While all Contrast agents share the same property formatting in YAML configuration files, each agent must use its own specified file as there are unique properties that apply to each agent.

The configuration file must be called contrast_security.yaml and placed properly in the load path.

When you download the agent configuration file from Contrast, it will contain all the basic properties required for your instance of Contrast. If you create your own configuration file, you will need to add these keys yourself.

The minimum required contrast_security.yaml content for the latest version of the agents should look like this:

Legacy settings: For older agents, the minimum required contrast_security.yaml content for all agents should look like this:

api:  
    url: https://<environment>-agents.contrastsecurity.com/Contrast 
    user_name: contrast_user  
    api_key: demo  
    service_key: demo

Tip

  • Use the Contrast agent configuration editor to create or upload a YAML configuration file, validate YAML and get setting recommendations.

  • Since YAML is a natural superset of JSON, you can also configure your agent using JSON in your YAML file.

You can use these YAML templates to create a contrast_security.yaml for each agent:

Caution

Take care when editing the YAML template as it relies on whitespace, and uses spaces but not tabs. Configuration guidance is provided in the template as comments. (A space followed by the pound sign "#" starts a comment.)