From d0413e3ea861a5c3387edf15b54a857a30f04c38 Mon Sep 17 00:00:00 2001 From: Thomas Anderson Date: Sun, 23 Jul 2023 09:21:51 -0400 Subject: [PATCH] fix: allow env var templating for go2rtc rtsp creds (#6449) --- docker/rootfs/usr/local/go2rtc/create_config.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/docker/rootfs/usr/local/go2rtc/create_config.py b/docker/rootfs/usr/local/go2rtc/create_config.py index 0531b173d..790d90100 100644 --- a/docker/rootfs/usr/local/go2rtc/create_config.py +++ b/docker/rootfs/usr/local/go2rtc/create_config.py @@ -67,8 +67,19 @@ else: # as source for frigate and the integration supports HLS playback if go2rtc_config.get("rtsp") is None: go2rtc_config["rtsp"] = {"default_query": "mp4"} -elif go2rtc_config["rtsp"].get("default_query") is None: - go2rtc_config["rtsp"]["default_query"] = "mp4" +else: + if go2rtc_config["rtsp"].get("default_query") is None: + go2rtc_config["rtsp"]["default_query"] = "mp4" + + if go2rtc_config["rtsp"].get("username") is not None: + go2rtc_config["rtsp"]["username"] = go2rtc_config["rtsp"]["username"].format( + **FRIGATE_ENV_VARS + ) + + if go2rtc_config["rtsp"].get("password") is not None: + go2rtc_config["rtsp"]["password"] = go2rtc_config["rtsp"]["password"].format( + **FRIGATE_ENV_VARS + ) # need to replace ffmpeg command when using ffmpeg4 if int(os.environ["LIBAVFORMAT_VERSION_MAJOR"]) < 59: