# 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](/core/api/config.md) (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="/pages/QHTHrzIbgkDyUQ3G1ZBe" %}
[Logging](/core/configuration/logging.md)
{% endcontent-ref %}

### db

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

{% content-ref url="/pages/UC7Zr5z6K7FeSjzqh1ON" %}
[Database](/core/configuration/database.md)
{% endcontent-ref %}

### host

Configuration to detect or set the host-/domainname.

{% content-ref url="/pages/BKMZfmFy5bVLlDbqk5UU" %}
[Hostname](/core/configuration/hostname.md)
{% endcontent-ref %}

### api

API Security options.

{% content-ref url="/pages/BVeGjgPvhjHjN3ThePBj" %}
[API Security](/core/configuration/api-security.md)
{% endcontent-ref %}

### tls

TLS/HTTPS settings (also required for RTMPS).

{% content-ref url="/pages/EDqdXi6Zf0GoLIZxxoaE" %}
[TLS / HTTPS](/core/configuration/tls-https.md)
{% endcontent-ref %}

### storage

General configuration, DiskFS, MemFS, and S3.

{% content-ref url="/pages/wweYeznY5hUh4nVxtJqf" %}
[Storage](/core/configuration/storage.md)
{% endcontent-ref %}

### rtmp

RTMP server for publishing and playing streams.

{% content-ref url="/pages/vu8lTamGCyWUajx2Uqgx" %}
[RTMP](/core/configuration/rtmp.md)
{% endcontent-ref %}

### srt

SRT server for publishing and playing streams.

{% content-ref url="/pages/K17uJ3nKSj9VFXj3V0W3" %}
[SRT](/core/configuration/srt.md)
{% endcontent-ref %}

### ffmpeg

General FFmpeg settings.

{% content-ref url="/pages/GdhdGBbvza70hmP8lMo8" %}
[FFmpeg](/core/configuration/ffmpeg.md)
{% endcontent-ref %}

### session

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

{% content-ref url="/pages/KBYBECnDQK2UU51vkwkK" %}
[Sessions](/core/configuration/sessions.md)
{% endcontent-ref %}

### metrics

General metrics settings.

{% content-ref url="/pages/5f0RCEakrh7kfZpuDYgs" %}
[Metrics](/core/configuration/metrics.md)
{% endcontent-ref %}

### route

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

{% content-ref url="/pages/7KTUnIlZdpZcpD7mWB7K" %}
[Router](/core/configuration/router.md)
{% endcontent-ref %}

### debug

Core / Golang debugging options.

{% content-ref url="/pages/6cWKkoovVn69sifZSzj7" %}
[Debug](/core/configuration/debug.md)
{% 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.*


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.datarhei.com/core/configuration.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
