From 6060574112ed82c050b77936e0f796fa99332e12 Mon Sep 17 00:00:00 2001 From: Ryan Berckmans Date: Sat, 13 Jul 2024 03:48:12 -0500 Subject: [PATCH] Prioritize env var over mkcert for ca root path --- pretix_eth/verifier/verify_payment.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pretix_eth/verifier/verify_payment.py b/pretix_eth/verifier/verify_payment.py index 8910fbc..e4527bf 100644 --- a/pretix_eth/verifier/verify_payment.py +++ b/pretix_eth/verifier/verify_payment.py @@ -9,14 +9,17 @@ def get_grpc_ca_root_cert_file_path(): + grpc_ca_root_cert_file_path = os.getenv("THREECITIES_GRPC_CA_ROOT_CERT") + if grpc_ca_root_cert_file_path: + return grpc_ca_root_cert_file_path try: completed_process = subprocess.run( ["mkcert", "-CAROOT"], capture_output=True, check=True, text=True) ca_root_path = completed_process.stdout.strip() return os.path.join(ca_root_path, "rootCA.pem") except subprocess.CalledProcessError as e: - logger.error(f"error obtaining CA root path: {e}") - return os.getenv("THREECITIES_GRPC_CA_ROOT_CERT") or None + logger.error(f"Error obtaining CA root path: {e}") + return None grpc_stub = None