Install the Go agent

Install the Go agent on your system.


Quickstart

Installing the Sqreen Go agent enables you to monitor the security of your application and block attacks in real-time. Installing Go in your application takes less than a minute:

  • Sign up to Sqreen to create your account.
  • Pick up your first application name and language. The name of the application can be the name of the repository, or anything that helps you identify the app in your Sqreen dashboard.
  • Follow the procedure detailed below.

Standard Go application

Download the Go agent and the SDK using go get:

go get github.com/sqreen/go-agent/...

Import the package agent in the main package of your app:

import _ "github.com/sqreen/go-agent/agent"

Signup to Sqreen to get a token for your app, and store it in the agent's configuration file sqreen.yaml:

token: "your token"
app_name: "Your App Name"

The Go agent does not automatically detect your web framework and you have to install the middleware functions for the web framework you use to use the SDK methods described below.

Install the agent on non production environment

Typically you install the Sqreen agent in your production environment, but you can create several applications using your Sqreen dashboard, and specify the environment (development, staging, production). A unique Sqreen token is provided for each of your applications.

Basic configuration

The previous installation steps store the configuration in the sqreen.yaml file containing your Sqreen token and your application name displayed in the dashboard.

Instead of using the Sqreen configuration file sqreen.yaml, you can also use environment variables:

export SQREEN_TOKEN="your token"
export SQREEN_APP_NAME="Your App Name"

The Sqreen Go agent provides flexible configuration settings. Refer to Configuration of the Go agent for more detailed information.

Uninstall the agent

To uninstall the Sqreen agent, remove the package from your dependencies.