From fde2cd654b425eb31c3394158d608f5e6aa0cedf Mon Sep 17 00:00:00 2001
From: duc_buitien <duc.buitien@ilr.rwth-aachen.de>
Date: Thu, 15 Aug 2024 15:11:03 +0200
Subject: [PATCH] add reset to default

---
 main.py | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/main.py b/main.py
index 0d894f4..3d8c785 100644
--- a/main.py
+++ b/main.py
@@ -128,6 +128,14 @@ async def update_module_config(config: Conf):
         fd.write(xml)
         return
 
+@app.get("/modules/{module}/config/reset")
+async def reset_module_config(module:str):
+    with open("xml_configs/"+module+"_conf_default.xml", encoding='utf8') as fd:
+        config = json.dumps(xmltodict.parse(fd.read()))
+    with open("xml_configs/"+module+"_conf.xml", "w") as fd:
+        fd.write(config)
+    return
+
 @app.get("/graph/")
 async def get_plotData():
     plotData = {}
-- 
GitLab