fix: numbered mode selection, remove duplicate create_config
This commit is contained in:
parent
f3c82258ac
commit
30c24da698
1 changed files with 7 additions and 20 deletions
|
|
@ -181,25 +181,6 @@ def main():
|
|||
elif c.lower() == "q":
|
||||
break
|
||||
|
||||
def create_config():
|
||||
print("\n─── Create Node Config ───")
|
||||
name = input("Node name: ").strip()
|
||||
if not name: return
|
||||
token = input("Wallarm token: ").strip()
|
||||
cloud = input("Cloud [EU]: ").strip() or "EU"
|
||||
port = input("Port [8081]: ").strip() or "8081"
|
||||
upstream_ip = input("Upstream IP [127.0.0.1]: ").strip() or "127.0.0.1"
|
||||
upstream_port = input("Upstream port [80]: ").strip() or "80"
|
||||
mode = input("Mode [monitoring]: ").strip() or "monitoring"
|
||||
|
||||
cfg = load_config()
|
||||
cfg[name] = {"token": token, "cloud": cloud, "port": port,
|
||||
"upstream_ip": upstream_ip, "upstream_port": upstream_port,
|
||||
"labels": f"group={name}", "mode": mode}
|
||||
os.makedirs(APP, exist_ok=True)
|
||||
with open(CONF, "w") as f:
|
||||
json.dump(cfg, f, indent=2)
|
||||
print(f"✅ {name} added to fw.conf")
|
||||
|
||||
def add_node():
|
||||
print("\n─── Add New Node ───")
|
||||
|
|
@ -211,7 +192,13 @@ def add_node():
|
|||
port = input("Port [8081]: ").strip() or "8081"
|
||||
upstream_ip = input("Upstream IP [127.0.0.1]: ").strip() or "127.0.0.1"
|
||||
upstream_port = input("Upstream port [80]: ").strip() or "80"
|
||||
mode = input("Mode [monitoring]: ").strip() or "monitoring"
|
||||
print("\nTraffic mode:")
|
||||
print(" [1] monitoring — detect only")
|
||||
print(" [2] safe_blocking — block definitely malicious")
|
||||
print(" [3] block — block all attacks")
|
||||
print(" [4] off — disable")
|
||||
m = input("Choose [1]: ").strip()
|
||||
mode = {"1":"monitoring","2":"safe_blocking","3":"block","4":"off"}.get(m, "monitoring")
|
||||
|
||||
# Save to fw.conf
|
||||
cfg = load_config()
|
||||
|
|
|
|||
Loading…
Reference in a new issue