Config
Last updated
Was this helpful?
Last updated
Was this helpful?
The /api/v3/config
endpoints allow you to inspect, modify, and reload the configuration of the datarhei Core.
Retrieve the currently active Core configuration with additionally a list of all fields that have an override by an environment variable. Such fields can be changed, but it will have no effect because the enviroment variable will always override the value.
Example:
curl http://127.0.0.1:8080/api/v3/config \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-X GET
from core_client import Client
client = Client(base_url="http://127.0.0.1:8080")
client.login()
core_config = client.v3_config_get()
print(core_config)
import (
"github.com/datarhei/core-client-go/v16"
"github.com/datarhei/core-client-go/v16/api"
)
client, _ := coreclient.New(coreclient.Config{
Address: "https://127.0.0.1:8080",
})
version, config, err := client.Config()
The actual config is in config.Config
which is an interface{}
type. Depending on the returned version, you have to cast it to the corresponding type in order to access the fields in the config:
if version == 1 {
configv1 := config.Config.(api.ConfigV1)
} else if version == 2 {
configv2 := config.Config.(api.ConfigV2)
} else if version == 3 {
configv3 := config.Config.(api.ConfigV3)
}
Description:
Upload a modified configuration. You can provide a partial configuration with only the fields you want to change. The minimal valid configuration you have to provide contains the version number:
{
"version": 3
}
Example:
curl http://127.0.0.1:8080/api/v3/config \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-X PUT \
-d '{
"version": 3,
"name": "core-1",
"log": {
"level": "debug"
}
}'
from core_client import Client
client = Client(base_url="http://127.0.0.1:8080")
client.login()
client.v3_config_put(config: {
"version": 3,
"name": "core-1",
"log": {
"level": "debug"
}
})
import (
"github.com/datarhei/core-client-go/v16"
)
client, _ := coreclient.New(coreclient.Config{
Address: "https://127.0.0.1:8080",
})
type cfg struct{
Version int64 `json:"version"`
Name string `json:"name"`
Log struct{
Level string `json:"level"`
} `json:"log"`
}
var config = &cfg{
Version: 3,
Name: "core-1",
}
config.Log.Level = "debug"
err := client.ConfigSet(config)
This has no effect until the configuration is reloaded.
Description:
After changing the configuration, the datarhei Core has to be restarted in order to reload the changed configuration.
Example:
curl http://127.0.0.1:8080/api/v3/config/reload \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-X GET
from core_client import Client
client = Client(base_url="http://127.0.0.1:8080")
client.login()
client.v3_config_reload()
import (
"github.com/datarhei/core-client-go/v16"
)
client, _ := coreclient.New(coreclient.Config{
Address: "https://127.0.0.1:8080",
})
err := client.ConfigReload()
Configuration reload will restart the Core! The in-memory file system and sessions will remain intact.
Description:
Complete config example:
{
"version": 3,
"id": "03a1d1af-b947-4a13-a169-d3f2238714ee",
"name": "super-core-1337",
"address": ":8080",
"update_check": true,
"log": {
"level": "info",
"topics": [],
"max_lines": 1000
},
"db": {
"dir": "/core/config"
},
"host": {
"name": [
"example.com"
],
"auto": true
},
"api": {
"read_only": false,
"access": {
"http": {
"allow": [],
"block": []
},
"https": {
"allow": [],
"block": []
}
},
"auth": {
"enable": true,
"disable_localhost": false,
"username": "admin",
"password": "datarhei",
"jwt": {
"secret": "cz$L%a(d%%[lLh;Y8dahIjcQx+tBq(%5"
},
"auth0": {
"enable": false,
"tenants": []
}
}
},
"tls": {
"address": ":8181",
"enable": true,
"auto": true,
"email": "cert@example.com",
"cert_file": "",
"key_file": ""
},
"storage": {
"disk": {
"dir": "/core/data",
"max_size_mbytes": 50000,
"cache": {
"enable": true,
"max_size_mbytes": 500,
"ttl_seconds": 300,
"max_file_size_mbytes": 1,
"types": {
"allow": [],
"block": [
".m3u8",
".mpd"
]
}
}
},
"memory": {
"auth": {
"enable": true,
"username": "admin",
"password": "WH8y3alD7pHGsuBGwb"
},
"max_size_mbytes": 2000,
"purge": true
},
"s3": [],
"cors": {
"origins": [
"*"
]
},
"mimetypes_file": "./mime.types"
},
"rtmp": {
"enable": true,
"enable_tls": true,
"address": ":1935",
"address_tls": ":1936",
"app": "/",
"token": "n4jk235nNJKN4k5n24k"
},
"srt": {
"enable": true,
"address": ":6000",
"passphrase": "n23jk4DD5DOAn5jk4DSS",
"token": "",
"log": {
"enable": false,
"topics": []
}
},
"ffmpeg": {
"binary": "ffmpeg",
"max_processes": 0,
"access": {
"input": {
"allow": [],
"block": []
},
"output": {
"allow": [],
"block": []
}
},
"log": {
"max_lines": 50,
"max_history": 3
}
},
"playout": {
"enable": false,
"min_port": 0,
"max_port": 0
},
"debug": {
"profiling": false,
"force_gc": 0
},
"metrics": {
"enable": false,
"enable_prometheus": false,
"range_sec": 300,
"interval_sec": 2
},
"sessions": {
"enable": true,
"ip_ignorelist": [
"127.0.0.1/32",
"::1/128"
],
"session_timeout_sec": 30,
"persist": true,
"persist_interval_sec": 300,
"max_bitrate_mbit": 250,
"max_sessions": 50
},
"service": {
"enable": false,
"token": "",
"url": "https://service.datarhei.com"
},
"router": {
"blocked_prefixes": [
"/api"
],
"routes": {},
"ui_path": "/core/ui"
}
}
Required fields: version
curl -L \
--url '/api/v3/config' \
--header 'Authorization: YOUR_API_KEY'
{
"config": {
"address": "text",
"api": {
"access": {
"http": {
"allow": [
"text"
],
"block": [
"text"
]
},
"https": {
"allow": [
"text"
],
"block": [
"text"
]
}
},
"auth": {
"auth0": {
"enable": true,
"tenants": [
{
"audience": "text",
"clientid": "text",
"domain": "text",
"users": [
"text"
]
}
]
},
"disable_localhost": true,
"enable": true,
"jwt": {
"secret": "text"
},
"password": "text",
"username": "text"
},
"read_only": true
},
"created_at": "text",
"db": {
"dir": "text"
},
"debug": {
"force_gc": 1,
"profiling": true
},
"ffmpeg": {
"access": {
"input": {
"allow": [
"text"
],
"block": [
"text"
]
},
"output": {
"allow": [
"text"
],
"block": [
"text"
]
}
},
"binary": "text",
"log": {
"max_history": 1,
"max_lines": 1
},
"max_processes": 1
},
"host": {
"auto": true,
"name": [
"text"
]
},
"id": "text",
"log": {
"level": "debug",
"max_lines": 1,
"topics": [
"text"
]
},
"metrics": {
"enable": true,
"enable_prometheus": true,
"interval_sec": 1,
"range_sec": 1
},
"name": "text",
"playout": {
"enable": true,
"max_port": 1,
"min_port": 1
},
"router": {
"blocked_prefixes": [
"text"
],
"routes": {
"ANY_ADDITIONAL_PROPERTY": "text"
},
"ui_path": "text"
},
"rtmp": {
"address": "text",
"address_tls": "text",
"app": "text",
"enable": true,
"enable_tls": true,
"token": "text"
},
"service": {
"enable": true,
"token": "text",
"url": "text"
},
"sessions": {
"enable": true,
"ip_ignorelist": [
"text"
],
"max_bitrate_mbit": 1,
"max_sessions": 1,
"persist": true,
"persist_interval_sec": 1,
"session_timeout_sec": 1
},
"srt": {
"address": "text",
"enable": true,
"log": {
"enable": true,
"topics": [
"text"
]
},
"passphrase": "text",
"token": "text"
},
"storage": {
"cors": {
"origins": [
"text"
]
},
"disk": {
"cache": {
"enable": true,
"max_file_size_mbytes": 1,
"max_size_mbytes": 1,
"ttl_seconds": 1,
"types": {
"allow": [
"text"
],
"block": [
"text"
]
}
},
"dir": "text",
"max_size_mbytes": 1
},
"memory": {
"auth": {
"enable": true,
"password": "text",
"username": "text"
},
"max_size_mbytes": 1,
"purge": true
},
"mimetypes_file": "text"
},
"tls": {
"address": "text",
"auto": true,
"cert_file": "text",
"email": "text",
"enable": true,
"key_file": "text"
},
"update_check": true,
"version": 1
},
"created_at": "text",
"loaded_at": "text",
"overrides": [
"text"
],
"updated_at": "text"
}
Update the current Restreamer configuration by providing a complete or partial configuration. Fields that are not provided will not be changed.
curl -L \
--request PUT \
--url '/api/v3/config' \
--header 'Authorization: YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"address": "text",
"api": {
"access": {
"http": {
"allow": [
"text"
],
"block": [
"text"
]
},
"https": {
"allow": [
"text"
],
"block": [
"text"
]
}
},
"auth": {
"auth0": {
"enable": true,
"tenants": [
{
"audience": "text",
"clientid": "text",
"domain": "text",
"users": [
"text"
]
}
]
},
"disable_localhost": true,
"enable": true,
"jwt": {
"secret": "text"
},
"password": "text",
"username": "text"
},
"read_only": true
},
"created_at": "text",
"db": {
"dir": "text"
},
"debug": {
"force_gc": 1,
"profiling": true
},
"ffmpeg": {
"access": {
"input": {
"allow": [
"text"
],
"block": [
"text"
]
},
"output": {
"allow": [
"text"
],
"block": [
"text"
]
}
},
"binary": "text",
"log": {
"max_history": 1,
"max_lines": 1
},
"max_processes": 1
},
"host": {
"auto": true,
"name": [
"text"
]
},
"id": "text",
"log": {
"level": "debug",
"max_lines": 1,
"topics": [
"text"
]
},
"metrics": {
"enable": true,
"enable_prometheus": true,
"interval_sec": 1,
"range_sec": 1
},
"name": "text",
"playout": {
"enable": true,
"max_port": 1,
"min_port": 1
},
"router": {
"blocked_prefixes": [
"text"
],
"routes": {
"ANY_ADDITIONAL_PROPERTY": "text"
},
"ui_path": "text"
},
"rtmp": {
"address": "text",
"address_tls": "text",
"app": "text",
"enable": true,
"enable_tls": true,
"token": "text"
},
"service": {
"enable": true,
"token": "text",
"url": "text"
},
"sessions": {
"enable": true,
"ip_ignorelist": [
"text"
],
"max_bitrate_mbit": 1,
"max_sessions": 1,
"persist": true,
"persist_interval_sec": 1,
"session_timeout_sec": 1
},
"srt": {
"address": "text",
"enable": true,
"log": {
"enable": true,
"topics": [
"text"
]
},
"passphrase": "text",
"token": "text"
},
"storage": {
"cors": {
"origins": [
"text"
]
},
"disk": {
"cache": {
"enable": true,
"max_file_size_mbytes": 1,
"max_size_mbytes": 1,
"ttl_seconds": 1,
"types": {
"allow": [
"text"
],
"block": [
"text"
]
}
},
"dir": "text",
"max_size_mbytes": 1
},
"memory": {
"auth": {
"enable": true,
"password": "text",
"username": "text"
},
"max_size_mbytes": 1,
"purge": true
},
"mimetypes_file": "text"
},
"tls": {
"address": "text",
"auto": true,
"cert_file": "text",
"email": "text",
"enable": true,
"key_file": "text"
},
"update_check": true,
"version": 1
}'
text
OK