Configure the Go agent

The standard configuration for all agents uses this order of precedence, which also details other ways to configure the agent, such as other valid configuration file locations.

There are different ways to configure the Go agent:

  • A YAML configuration file (learn more) is required to run your application. It is not needed to run the Go agent. You can create your own YAML configuration file or use this template that contains all valid properties for the Go agent.

    You can configure the Contrast service separately or they can share the same contrast_security.yaml configuration file. Place the file in the directory your app will run from "." and then find the agent keys and set these values:

    api:
      url:
      api_key:
      service_key:
      user_name:
    agent:
      service:
        host: 127.0.0.1
        port: 30555
        #socket: /tmp/contrast.sock # optional: only `socket` OR `host` and `port` should be set
        grpc: true
  • You can use environment variables to configure your build.

  • Command line configuration is also available.

Tip

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

Go YAML template

Use this template to configure the Go agent using a YAML configuration file. (Learn more about YAML configuration.)

https://docs.contrastsecurity.com/common-agent-config/go_contrast_security.yaml