fix: handle nested and flat fw.conf formats

This commit is contained in:
admin 2026-08-03 13:24:44 +00:00
parent 350434e690
commit b3cf1c8250

View file

@ -105,10 +105,12 @@ def container_status():
def deploy_all(): def deploy_all():
cfg = load_config() cfg = load_config()
if not cfg.get("nodes"): nodes = cfg.get("nodes", cfg) # support both {"nodes":{...}} and flat format
if not nodes:
print("No nodes in fw.conf") print("No nodes in fw.conf")
return return
for name, nc in cfg.items(): for name, nc in nodes.items():
if not isinstance(nc, dict): continue
deploy_container(name, nc["token"], nc.get("cloud","EU"), deploy_container(name, nc["token"], nc.get("cloud","EU"),
str(nc.get("port","8081")), nc.get("upstream_ip","127.0.0.1"), str(nc.get("port","8081")), nc.get("upstream_ip","127.0.0.1"),
str(nc.get("upstream_port","80")), nc.get("labels",""), str(nc.get("upstream_port","80")), nc.get("labels",""),