Trying to get python bridge to work.

This commit is contained in:
Raphaël Numbus
2026-05-17 14:24:57 +02:00
parent df5132e97a
commit 27a5eca7f8
2 changed files with 18 additions and 11 deletions
+10 -6
View File
@@ -9,10 +9,10 @@ os.makedirs(SECRET_PATH, exist_ok=True)
LOGS_DIR = "logs/"
PAGES_DIR = "pages/"
CONFIG_DIR = "config/"
SIGNALS_DIR = "signal/"
SIGNALS_DIR = "signals/"
### <-- Variables
os.chdir(web/)
os.chdir('web')
class BridgeHandler(http.server.SimpleHTTPRequestHandler):
def do_GET(self):
@@ -39,18 +39,22 @@ class BridgeHandler(http.server.SimpleHTTPRequestHandler):
if self.path == '/discovery':
# Store secrets in memory-backed filesystem
with open(os.path.join(SECRET_PATH, "live.yaml"), "wb") as f:
# We write to CONFIG_DIR so deploy.sh can find it easily
os.makedirs(CONFIG_DIR, exist_ok=True)
with open(os.path.join(CONFIG_DIR, "live.yaml"), "wb") as f:
f.write(post_data)
self.send_response(200)
self.end_headers()
# Signal Bash that discovery data is ready
with open(os.path.join(SIGNALS_DIR, ".discovery_ready"), "w") as f: f.write("1")
# Signal Bash that discovery data is ready and we can proceed to hardware detection
os.makedirs(SIGNALS_DIR, exist_ok=True)
with open(os.path.join(SIGNALS_DIR, "hw_detection_ready"), "w") as f: f.write("1")
with open(os.path.join(SIGNALS_DIR, "configuration_ready"), "w") as f: f.write("1")
elif self.path == '/deploy':
with open(os.path.join(CONFIG_DIR, "numbus.yaml"), "wb") as f:
f.write(post_data)
self.send_response(200)
self.end_headers()
with open(os.path.join(SIGNALS_DIR, ".deploy_signal"), "w") as f: f.write("1")
with open(os.path.join(SIGNALS_DIR, "deployment_ready"), "w") as f: f.write("1")
http.server.HTTPServer(('localhost', 8088), BridgeHandler).serve_forever()