# Configuration

## Location

You have to provide the location of the config file by setting the environment variable `CORE_CONFIGFILE` to path to the config file. Example:

```
export CORE_CONFIGFILE=./config/config.json
```

The config file is written in JSON format.

{% hint style="success" %}
If the config file doesn't exist yet, it will be created and its fields will be filled with their default values.
{% endhint %}

{% hint style="success" %}
If the config file is partially complete or of an older version, it will be upgraded and the missing fields will be filled with their default values.
{% endhint %}

{% hint style="warning" %}
If you don't provide the `CORE_CONFIGFILE` environment variable, the default config values will be used and the configuration will not be persisted to the disk.

**As of version 16.12.0:**

If no path is given in the environment variable CORE\_CONFIGFILE, different standard locations will be probed:

* os.UserConfigDir() + /datarhei-core/config.js
* os.UserHomeDir() + /.config/datarhei-core/config.js
* ./config/config.js

If the config.js doesn't exist in any of these locations, it will be assumed at ./config/config.js
{% endhint %}

A minimal valid config file must contain at least the config version:

```json
{
    "version": 3
}
```

## **Configuration**

Configuration values can be changed by either editing the config file directly, or via the [JSON API](https://docs.datarhei.com/core/api/config) (API for short) or via environment variables (ENV for short). All environment variables have the prefix `CORE_` followed by the JSON names in uppercase. Example:

{% tabs %}
{% tab title="JSON" %}

```json
{
   "version": 3,
   "id": "1",
   "name": "super-core-1337",
   "address": ":8080",
   "log": {
      "level": "warn"
   }
}
```

{% endtab %}

{% tab title="ENV" %}

```shell
CORE_ID=1
CORE_NAME=super-core-1337
CORE_ADDRESS=:8080
CORE_LOG_LEVEL=warn
```

{% endtab %}
{% endtabs %}

Following, every field of the configuration file will be described in detail:

### id (string)

ID of the Core. If not set, a UUIDv4 will be generated.\
Default: unset

### name (string)

Human-readable name of the Core. If not set a custom name will be generated.\
Default: unset

### address (string)

HTTP listening address.\
Default: `:8080`

{% hint style="info" %}
The default `:8080` will listen on all interfaces on port 8080. To use a specific interface, write additionally it's IP, e.g. `127.0.0.1:8080` to only listen on the loopback interface.
{% endhint %}

### log

Log settings.

{% content-ref url="configuration/logging" %}
[logging](https://docs.datarhei.com/core/configuration/logging)
{% endcontent-ref %}

### db

Database (processes, metadata, ...) endpoint.

{% content-ref url="configuration/database" %}
[database](https://docs.datarhei.com/core/configuration/database)
{% endcontent-ref %}

### host

Configuration to detect or set the host-/domainname.

{% content-ref url="configuration/hostname" %}
[hostname](https://docs.datarhei.com/core/configuration/hostname)
{% endcontent-ref %}

### api

API Security options.

{% content-ref url="configuration/api-security" %}
[api-security](https://docs.datarhei.com/core/configuration/api-security)
{% endcontent-ref %}

### tls

TLS/HTTPS settings (also required for RTMPS).

{% content-ref url="configuration/tls-https" %}
[tls-https](https://docs.datarhei.com/core/configuration/tls-https)
{% endcontent-ref %}

### storage

General configuration, DiskFS, MemFS, and S3.

{% content-ref url="configuration/storage" %}
[storage](https://docs.datarhei.com/core/configuration/storage)
{% endcontent-ref %}

### rtmp

RTMP server for publishing and playing streams.

{% content-ref url="configuration/rtmp" %}
[rtmp](https://docs.datarhei.com/core/configuration/rtmp)
{% endcontent-ref %}

### srt

SRT server for publishing and playing streams.

{% content-ref url="configuration/srt" %}
[srt](https://docs.datarhei.com/core/configuration/srt)
{% endcontent-ref %}

### ffmpeg

General FFmpeg settings.

{% content-ref url="configuration/ffmpeg" %}
[ffmpeg](https://docs.datarhei.com/core/configuration/ffmpeg)
{% endcontent-ref %}

### session

HLS-/MPEG-DASH session management and bandwidth limitations.

{% content-ref url="configuration/sessions" %}
[sessions](https://docs.datarhei.com/core/configuration/sessions)
{% endcontent-ref %}

### metrics

General metrics settings.

{% content-ref url="configuration/metrics" %}
[metrics](https://docs.datarhei.com/core/configuration/metrics)
{% endcontent-ref %}

### route

HTTP/S route configuration (e.g., to inject UI's).

{% content-ref url="configuration/router" %}
[router](https://docs.datarhei.com/core/configuration/router)
{% endcontent-ref %}

### debug

Core / Golang debugging options.

{% content-ref url="configuration/debug" %}
[debug](https://docs.datarhei.com/core/configuration/debug)
{% endcontent-ref %}

### update\_check (bool)

All about datarhei Update-Checks and data tracking.&#x20;

{% tabs %}
{% tab title="JSON" %}

```
{
   "update_check": true,
   "service": {
      "url": "https://service.datarhei.com"
   }
}
```

{% endtab %}

{% tab title="ENV" %}
CORE\_UPDATE\_CHECK=true

CORE\_SERVICE\_URL=<https://service.datarhei.com>
{% endtab %}
{% endtabs %}

Check for updates and send anonymized data (default: false).\
Requires `service.url`.

{% hint style="success" %}
IP addresses are anonymized and stored for 30 days on servers in the EU.
{% endhint %}

#### service.url (string)

URL for the `update_check` Service API.\
Default: <https://service.datarhei.com>

**About anonymizied data:**

We receive:\
id, os architecture, uptime, process stats (total: running, failed, killed), viewer count

The data is used exclusively for the further development of the products and error detection.\
\&#xNAN;*Domains/IP addresses, companies, and persons remain anonymous.*
