Skip to content

Commit

Permalink
Prioritize env var over mkcert for ca root path
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanberckmans committed Jul 13, 2024
1 parent 325f74d commit 6060574
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions pretix_eth/verifier/verify_payment.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 6060574

Please sign in to comment.