Add frigate env var subsitutions

This commit is contained in:
Nick Mowen 2023-01-15 17:59:15 -07:00
parent ea88aa095f
commit 868c947f74

View File

@ -4,6 +4,8 @@ import json
import os import os
import yaml import yaml
FRIGATE_ENV_VARS = {k: v for k, v in os.environ.items() if k.startswith("FRIGATE_")}
config_file = os.environ.get("CONFIG_FILE", "/config/config.yml") config_file = os.environ.get("CONFIG_FILE", "/config/config.yml")
# Check if we can use .yaml instead of .yml # Check if we can use .yaml instead of .yml
@ -27,4 +29,7 @@ if not go2rtc_config.get("log", {}).get("format"):
if not go2rtc_config.get("webrtc", {}).get("candidates", []): if not go2rtc_config.get("webrtc", {}).get("candidates", []):
go2rtc_config["webrtc"] = {"candidates": ["stun:8555"]} go2rtc_config["webrtc"] = {"candidates": ["stun:8555"]}
for name in go2rtc_config.get("streams", {}):
go2rtc_config["streams"][name] = go2rtc_config["streams"][name].format(**FRIGATE_ENV_VARS)
print(json.dumps(go2rtc_config)) print(json.dumps(go2rtc_config))