From 959db573911cd98d4f76b22663680ac90888a7a2 Mon Sep 17 00:00:00 2001 From: Kumi Date: Thu, 18 Jul 2024 18:02:09 +0200 Subject: [PATCH] fix(config): Ensure no exception when keys are missing Added fallback parameters to config retrieval to prevent exceptions when WireGuard private and preshared keys are missing. This ensures that keys are generated when not provided, improving robustness and preventing potential runtime errors. --- worker.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/worker.py b/worker.py index 5187513..a1f7564 100644 --- a/worker.py +++ b/worker.py @@ -354,12 +354,12 @@ def run(config, provider, location, server_type): ssh_execute_command(server_ip, command) # Check if private key and preshared key are provided - if config.get("wireguard", "private_key"): + if config.get("wireguard", "private_key", fallback=None): private_key = config["wireguard"]["private_key"] else: private_key = generate_private_key() - if config.get("wireguard", "preshared_key"): + if config.get("wireguard", "preshared_key", fallback=None): preshared_key = config["wireguard"]["preshared_key"] else: preshared_key = generate_preshared_key()