From 1f9ed9eaaa38adf9f459b8bdbcd2ee292b841573 Mon Sep 17 00:00:00 2001 From: Josh Hawkins <32435876+hawkeye217@users.noreply.github.com> Date: Fri, 21 Aug 2026 18:24:54 -0500 Subject: [PATCH] use yml as default config file extension when not found --- frigate/util/config.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/frigate/util/config.py b/frigate/util/config.py index ad550d67e6..8c5ef1fba6 100644 --- a/frigate/util/config.py +++ b/frigate/util/config.py @@ -79,10 +79,20 @@ def redact_credential(obj: dict[str, Any], key: str) -> None: def find_config_file() -> str: + """Return the path of the config file to use. + + Both .yml and .yaml are supported, so fall back to the other extension when + the configured path does not exist. If neither exists the configured path is + returned so a new config is created with the default .yml extension. + """ config_path = os.environ.get("CONFIG_FILE", DEFAULT_CONFIG_FILE) if not os.path.isfile(config_path): - config_path = config_path.replace("yml", "yaml") + base, ext = os.path.splitext(config_path) + alternate = f"{base}.yaml" if ext == ".yml" else f"{base}.yml" + + if os.path.isfile(alternate): + return alternate return config_path