22 lines
538 B
Python
22 lines
538 B
Python
#!/usr/bin/env python3
|
|
import sys
|
|
from dotenv import load_dotenv
|
|
from utils.wg_easy import get_env_auth, ensure_client_and_config
|
|
|
|
load_dotenv()
|
|
|
|
if len(sys.argv) < 2:
|
|
sys.exit("Usage: wg-easy-create-client.py <name>")
|
|
|
|
name = sys.argv[1]
|
|
|
|
base, auth = get_env_auth()
|
|
|
|
# Ensure client exists and fetch its configuration
|
|
client_id, iface, cfg_text = ensure_client_and_config(base, auth, name)
|
|
|
|
out = f"wg-{name}.conf"
|
|
with open(out, "w") as f:
|
|
f.write(cfg_text)
|
|
print(f"✅ Saved config to {out} (id={client_id}, iface={iface}).")
|