Skip to content

Commit

Permalink
Add support for static.json with no PSC config
Browse files Browse the repository at this point in the history
  • Loading branch information
rhatgadkar-goog committed Jan 3, 2025
1 parent c65f700 commit ecb6a68
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion google/cloud/alloydb/connector/static.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,13 @@ def __init__(self, instance_uri: str, static_conn_info: io.TextIOBase) -> None:
static_info = json.load(static_conn_info)
ca_cert = static_info[instance_uri]["caCert"]
cert_chain = static_info[instance_uri]["pemCertificateChain"]
dns = ""
if static_info[instance_uri]["pscInstanceConfig"]:
dns = static_info[instance_uri]["pscInstanceConfig"]["pscDnsName"].rstrip(".")
ip_addrs = {
"PRIVATE": static_info[instance_uri]["ipAddress"],
"PUBLIC": static_info[instance_uri]["publicIpAddress"],
"PSC": static_info[instance_uri]["pscInstanceConfig"]["pscDnsName"],
"PSC": dns,
}
expiration = datetime.now(timezone.utc) + timedelta(hours=1)
priv_key = static_info["privateKey"]
Expand Down

0 comments on commit ecb6a68

Please sign in to comment.