From 40058d1b7b710d09b9009be8b2ab0f10764d28a9 Mon Sep 17 00:00:00 2001 From: Nick Mowen Date: Mon, 5 Dec 2022 20:35:41 -0700 Subject: [PATCH] Add raw config endpoint --- frigate/http.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/frigate/http.py b/frigate/http.py index a1f9aea4e..7df3300e5 100644 --- a/frigate/http.py +++ b/frigate/http.py @@ -599,6 +599,25 @@ def config(): return jsonify(config) +@bp.route("/config/raw") +def config_raw(): + config_file = os.environ.get("CONFIG_FILE", "/config/config.yml") + + # Check if we can use .yaml instead of .yml + config_file_yaml = config_file.replace(".yml", ".yaml") + + if os.path.isfile(config_file_yaml): + config_file = config_file_yaml + + if not os.path.isfile(config_file): + return "Could not find file", 410 + + with open(config_file) as f: + raw_config = f.read() + f.close() + return raw_config, 200 + + @bp.route("/config/schema") def config_schema(): return current_app.response_class(