add configurable firewall host IP for firewall command generation

This commit is contained in:
CPTN Cosmo 2026-04-18 16:48:41 +02:00
parent 340f8e5bef
commit f57d2fc6be
4 changed files with 28 additions and 1 deletions

View file

@ -15,6 +15,7 @@ from cryptography.fernet import Fernet
WEB_PASSWORD = os.getenv("WEB_PASSWORD", "admin")
ENCRYPTION_KEY = os.getenv("ENCRYPTION_KEY")
FIREWALL_HOST_IP = os.getenv("FIREWALL_HOST_IP")
DB_PATH = "data/instances.db"
if not ENCRYPTION_KEY or ENCRYPTION_KEY == "CHANGE_ME_TO_A_VALID_FERNET_KEY":
@ -166,6 +167,10 @@ def create_instance(inst: InstanceCreate):
conn.close()
return {"status": "ok"}
@app.get("/api/config")
def get_config():
return {"firewall_host_ip": FIREWALL_HOST_IP}
@app.delete("/api/instances/{id}")
def delete_instance(id: int):
conn = sqlite3.connect(DB_PATH)