> For the complete documentation index, see [llms.txt](https://cover-docs.diffblue.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://cover-docs.diffblue.com/features/cover-cli/environment-configuration.md).

# Environment Configuration

The environment where Cover is run can be configured in several ways:

* Setting properties in Java Properties files
* Setting Environment variables
* Setting Java system properties

Predominantly, environment variables are used, but some of these properties can also be set in a Java Properties file called `cover.properties`*.*

## Precedence of Configuration Options

Diffblue Cover accepts many ways to configure the CLI. When an option is specified multiple ways, the following is the precedence:

1. Command line arguments, e.g.: `dcover upload <url>`
2. [Argument files](/features/cover-cli/commands-and-arguments/argument-files.md)
3. [System properties](#setting-system-properties)
4. [Environment variables](#setting-environment-variables)
5. [Properties files](#setting-system-properties)

## cover.properties

To use **cover.properties** a new file called `cover.properties` must be created in the `.diffblue` folder in the ***user home directory***.

Properties are added as a name/value pair separated with an `=`

For example:

`cover.reports.upload.url=http://example.com`

{% hint style="info" %}
Properties will be read when Cover starts its JVM and cached for future use. When using **Cover Plugin**, the JVM is the same as **Intellij**. Therefore, when changing properties, **Intellij** must be restarted to reflect the change.
{% endhint %}

### Setting environment variables

All the properties that can be set in `cover.properties` can also be set as environment variables. The name of the environment variable is the same as the property name except:

* All the letters are capitalised
* The `.` separators are replaced with underscores
* A prefix of `DIFFBLUE_` is added to disambiguate Diffblue variables on host systems with many variables

For example:

`cover.reports.upload.url` can be set in an environment variable as `DIFFBLUE_COVER_REPORTS_UPLOAD_URL`

{% hint style="info" %}
Environment variables have a higher precedence than properties set in `cover.properties`. Therefore, if the same variable is set in both places, the value from the environment variable will be used.
{% endhint %}

### Setting system properties

All the properties that can be set in `cover.properties` can also [passed as system properties](/features/cover-cli/commands-and-arguments.md#define) to Diffblue Cover. The name of the system property is the same as the property name prefixed by `com.diffblue.`.

For example:

`cover.reports.upload.url` can be set by passing a system property by adding a `-D` option to the Diffblue Cover command, e.g.

`dcover upload -Dcom.diffblue.cover.reports.upload.url=http://example.com`

### Available properties

The properties that can be set in `cover.properties` are:

| Name                       | Environment variable name           | Purpose                                                                                            | Example use                                   |
| -------------------------- | ----------------------------------- | -------------------------------------------------------------------------------------------------- | --------------------------------------------- |
| `cover.reports.username`   | `DIFFBLUE_COVER_REPORTS_USERNAME`   | name of user that can upload to an installed Cover Reports, e.g. when using `dcover upload`        | `cover.reports.username=reportsuser`          |
| `cover.reports.password`   | `DIFFBLUE_COVER_REPORTS_PASSWORD`   | password of user that can upload to an installed Cover Reports, e.g. when using `dcover upload`    | `cover.reports.password=some-password`        |
| `cover.reports.upload.url` | `DIFFBLUE_COVER_REPORTS_UPLOAD_URL` | URL of an installed Cover Reports to upload coverage reports into, e.g. when using `dcover upload` | `cover.reports.upload.url=http://example.com` |
