Skip to content

Conversation

@jackwotherspoon
Copy link
Collaborator

@jackwotherspoon jackwotherspoon commented Jan 10, 2025

Add support for universe_domain to be set via the GOOGLE_CLOUD_UNIVERSE_DOMAIN env var.

This will allow zero code changes to support non-GDU environments, instead users can set the env var.

Order of operations for setting universe domain will be as follows:

  1. Use universe_domain argument passed to Connector()
  2. Use GOOGLE_CLOUD_UNIVERSE_DOMAIN env var
  3. Use default "googleapis.com"

Fixes #1217

@jackwotherspoon jackwotherspoon self-assigned this Jan 10, 2025
@jackwotherspoon jackwotherspoon requested a review from a team as a code owner January 10, 2025 17:44
if universe_domain:
self._universe_domain = universe_domain
else:
self._universe_domain = os.environ.get("GOOGLE_CLOUD_UNIVERSE_DOMAIN") # type: ignore
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need to have # type: ignore here as os.environ.get has weird type hinting

was causing mypy check to complain during lint:

google/cloud/sql/connector/connector.py:179: error: Incompatible types in assignment (expression has type "Optional[str]", variable has type "str")  [assignment]

@jackwotherspoon jackwotherspoon merged commit ac77932 into main Jan 10, 2025
15 checks passed
@jackwotherspoon jackwotherspoon deleted the univese-domain-var branch January 10, 2025 20:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for GOOGLE_CLOUD_UNIVERSE_DOMAIN env variable

2 participants