mirror of
https://github.com/blakeblackshear/frigate.git
synced 2024-11-21 19:07:46 +01:00
Use frigate env var substitution (#5153)
This commit is contained in:
parent
d36ab05bf1
commit
5fa1fbafed
@ -6,6 +6,7 @@ import yaml
|
|||||||
|
|
||||||
|
|
||||||
BTBN_PATH = "/usr/lib/btbn-ffmpeg"
|
BTBN_PATH = "/usr/lib/btbn-ffmpeg"
|
||||||
|
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
|
||||||
@ -50,5 +51,14 @@ if not os.path.exists(BTBN_PATH):
|
|||||||
go2rtc_config["ffmpeg"][
|
go2rtc_config["ffmpeg"][
|
||||||
"rtsp"
|
"rtsp"
|
||||||
] = "-fflags nobuffer -flags low_delay -stimeout 5000000 -user_agent go2rtc/ffmpeg -rtsp_transport tcp -i {input}"
|
] = "-fflags nobuffer -flags low_delay -stimeout 5000000 -user_agent go2rtc/ffmpeg -rtsp_transport tcp -i {input}"
|
||||||
|
|
||||||
|
for name in go2rtc_config.get("streams", {}):
|
||||||
|
stream = go2rtc_config["streams"][name]
|
||||||
|
|
||||||
|
if isinstance(stream, str):
|
||||||
|
go2rtc_config["streams"][name] = go2rtc_config["streams"][name].format(**FRIGATE_ENV_VARS)
|
||||||
|
elif isinstance(stream, list):
|
||||||
|
for i, stream in enumerate(stream):
|
||||||
|
go2rtc_config["streams"][name][i] = stream.format(**FRIGATE_ENV_VARS)
|
||||||
|
|
||||||
print(json.dumps(go2rtc_config))
|
print(json.dumps(go2rtc_config))
|
||||||
|
Loading…
Reference in New Issue
Block a user