diff --git a/frigate/http.py b/frigate/http.py
index 1f4fb4e75..1d0d18766 100644
--- a/frigate/http.py
+++ b/frigate/http.py
@@ -762,6 +762,54 @@ def config_save():
return "Config successfully saved, restarting...", 200
+@bp.route("/config/saveonly", methods=["POST"])
+def config_save():
+ new_config = request.get_data().decode()
+
+ if not new_config:
+ return "Config with body param is required", 400
+
+ # Validate the config schema
+ try:
+ new_yaml = FrigateConfig.parse_raw(new_config)
+ except Exception as e:
+ return make_response(
+ jsonify(
+ {
+ "success": False,
+ "message": f"\nConfig Error:\n\n{str(traceback.format_exc())}",
+ }
+ ),
+ 400,
+ )
+
+ # Save the config to file
+ try:
+ 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
+
+ with open(config_file, "w") as f:
+ f.write(new_config)
+ f.close()
+ except Exception as e:
+ return make_response(
+ jsonify(
+ {
+ "success": False,
+ "message": f"Could not write config file, be sure that Frigate has write permission on the config file.",
+ }
+ ),
+ 400,
+ )
+
+ return "Config successfully saved", 200
+
+
@bp.route("/config/schema.json")
def config_schema():
return current_app.response_class(
diff --git a/web/src/routes/Config.jsx b/web/src/routes/Config.jsx
index 590201d47..de07374c7 100644
--- a/web/src/routes/Config.jsx
+++ b/web/src/routes/Config.jsx
@@ -40,6 +40,29 @@ export default function Config() {
});
};
+ const onHandleSaveConfigOnly = async (e) => {
+ if (e) {
+ e.stopPropagation();
+ }
+
+ axios
+ .post('config/saveonly', window.editor.getValue(), {
+ headers: { 'Content-Type': 'text/plain' },
+ })
+ .then((response) => {
+ if (response.status === 200) {
+ setSuccess(response.data);
+ }
+ })
+ .catch((error) => {
+ if (error.response) {
+ setError(error.response.data.message);
+ } else {
+ setError(error.message);
+ }
+ });
+ };
+
const handleCopyConfig = async () => {
copy(window.editor.getValue());
};
@@ -100,6 +123,9 @@ export default function Config() {
+