# Configuring source{d} Lookout
The behavior of **source{d} Lookout** is defined with two different configuration files:
- [`config.yml`](#config-yml), to define the global configuration of the server.
- [`.lookout.yml`](#lookout-yml), to override the analyzer default behavior in each repository.
# config.yml
**source{d} Lookout** is configured with the `config.yml` file, you can use the template [`config.yml.tpl`](/config.yml.tpl) to create your own. Use the `lookoutd` option `--config` to set the path to it, or use the default location at `./config.yml`. The config file is read on server startup, so `lookoutd` needs to be restarted in order to load a new configuration.
The most important things you need to configure for a local installation, are:
1. [Repositories](#repositories): define the repositories to be watched.
1. [Analyzers](#analyzers): add the gRPC addresses of the analyzers to be used by **source{d} Lookout**.
The main structure of `config.yml` is:
```yaml
providers:
github:
# configuration of GitHub provider
repositories:
# list of repositories to watch and user/token if needed
analyzers:
# list of named analyzers
timeout:
# configuration for the existing timeouts.
```
For more fine grained configuration, you should pay attention to the following documentation.
## Github Provider
The `providers.github` key configures how **source{d} Lookout** will connect with GitHub.
```yaml
providers:
github:
comment_footer: "_Comment made by '{{.Name}}'{{with .Feedback}}, [tell us]({{.}}){{end}}._"
# app_id: 1234
# private_key: ./key.pem
# installation_sync_interval: 1h
# watch_min_interval: 2s
```
`comment_footer` key defines the [go template](https://golang.org/pkg/text/template) that will be used for custom messages for every message posted on GitHub; see how to [add a custom message to the posted comments](#add-a-custom-message-to-the-posted-comments)
### Authentication with GitHub
**source{d} Lookout** needs to authenticate with GitHub. There are two ways to authenticate with GitHub:
- Using GitHub personal access tokens.
- Authenticating as a GitHub App.
Both are explained below.
#### Authentication with GitHub personal access tokens
The easiest method for testing purposes is using a [GitHub personal access token](https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line/). The token should have the `repo` scope enabled.
The credentials can be passed to `lookoutd`:
- globally for all watched repositories, using command line arguments or environment variables when running `lookoutd`:
- user: `--github-user` argument or `GITHUB_USER` environment variable.
- token: `--github-token` argument or `GITHUB_TOKEN` environment variable.
- per watched repository, following the instructions given by the [Repositories section](#repositories) of this docs.
#### Authentication as a GitHub App
For a production environment, you can use **source{d} Lookout** as a [GitHub App](https://developer.github.com/apps/about-apps/).
To do so, you must also unset any environment variable or option for the GitHub username and token authentication.
You need to create a GitHub App following the [documentation about creating a GitHub App](https://developer.github.com/apps/building-github-apps/creating-a-github-app/). The permissions that must be set are:
- Repository metadata: Read-only
- Pull requests: Read & write
- Repository contents: Read-only
- Commit statuses: Read & write
Download a private key following the [documentation about authenticating with GitHub Apps](https://developer.github.com/apps/building-github-apps/authenticating-with-github-apps/) and set the following fields in your `config.yml` file:
```yaml
providers:
github:
app_id: 1234
private_key: ./key.pem
installation_sync_interval: 1h
watch_min_interval: 10s
```
Then you need to install the GitHub App in all your repositories or in a list of them.
When the GitHub App authentication method is used, the repositories to analyze are retrieved automatically from the GitHub installations, so `repositories` list from `config.yml` is ignored.
The update interval to discover new installations and repositories is defined by `installation_sync_interval`.
The minimum watch interval to discover new pull requests and push events is defined by `watch_min_interval`.
#### Web Interface
The **source{d} Lookout** Web Interface to manage the installations of your GitHub App is currently under development, but you can find more details about it and its configuration at [Web Interface docs](web.md)
## Repositories
The list of repositories to be watched by **source{d} Lookout** is defined by:
- the `repositories` field at `config.yml`, or
- the repositories where the GitHub App is installed if you [authenticated as a GitHub App](#authentication-as-a-github-app). In that case, the `repositories` field in `config.yml` will be ignored.
The user and token to be used for the Github authentication can be defined per repository; if you do so, it will override the globally passed user and token.
```yaml
repositories:
- url: github.com/