From ebb5ee64fbdf8ac7119f9816fd4f85dcbefa8d64 Mon Sep 17 00:00:00 2001 From: Mattabyte Date: Tue, 28 Jan 2025 15:01:57 +1000 Subject: [PATCH] Environment Variable Validation/Error Handling --- nodes/secure_api_call.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/nodes/secure_api_call.py b/nodes/secure_api_call.py index e1ad18c..898cf4b 100644 --- a/nodes/secure_api_call.py +++ b/nodes/secure_api_call.py @@ -68,13 +68,17 @@ class SecureApiCall: if not env_name.replace("_", "").isalnum(): raise ValueError("Environment variable names must only contain letters, numbers, and underscores") env_var = f"COMFYUI_SECUREAPICALL_{env_name}" - api_url = os.getenv(env_var) or raise ValueError(f"Environment Variable {env_var} is not set") + api_url = os.getenv(env_var) + if not api_url: + raise ValueError(f"Environment Variable {env_var} is not set") if api_auth.startswith("$ENV."): env_name = api_auth.removeprefix("$ENV.") if not env_name.replace("_", "").isalnum(): raise ValueError("Environment variable names must only contain letters, numbers, and underscores") env_var = f"COMFYUI_SECUREAPICALL_{env_name}" - api_auth = os.getenv(env_var) or raise ValueError(f"Environment Variable {env_var} is not set") + api_auth = os.getenv(env_var) + if not api_auth: + raise ValueError(f"Environment Variable {env_var} is not set") # Send the payload to the API res = requests.post(