Configure the Go agent

The standard configuration for all agents uses this order of precedence.

There are different ways to configure the Go agent:

  • A YAML configuration file 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 YAML template that contains all valid properties for the Go agent.

    You can configure the Contrast service separately or they share the same contrast_security.yaml configuration file. Place the file at /etc/contrast/contrast_security.yaml and then find the agent keys and set these values:

    api:
      url:
      api_key:
      secret_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.

Go YAML template

You can use the YAML template below to modify your YAML properties.

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