diff --git a/custom_components/webrtc/utils.py b/custom_components/webrtc/utils.py index 7c1be1c..b6a1e7a 100644 --- a/custom_components/webrtc/utils.py +++ b/custom_components/webrtc/utils.py @@ -233,9 +233,10 @@ async def websocket_forward(ws_from, ws_to) -> None: class Server(Thread): - def __init__(self, binary: str): + def __init__(self, binary: str, config_dir: str = ""): super().__init__(name=DOMAIN, daemon=True) self.binary = binary + self.config_dir = config_dir self.process = None @property @@ -243,9 +244,12 @@ class Server(Thread): return self.process.poll() is None if self.process else False def run(self): + env = None + if self.config_dir: + env = {**__import__("os").environ, "CONFIG": self.config_dir + "/go2rtc.yaml"} while self.binary: self.process = subprocess.Popen( - [self.binary], stdout=subprocess.PIPE, stderr=subprocess.STDOUT + [self.binary], stdout=subprocess.PIPE, stderr=subprocess.STDOUT, env=env ) # check alive