Skip to content

Commit

Permalink
feat: add GCE_METADATA_DETECT_RETRIES to environment_vars.py
Browse files Browse the repository at this point in the history
  • Loading branch information
judahrand committed Mar 2, 2024
1 parent 8136cf1 commit e91f78b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion google/auth/compute_engine/_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
# Timeout in seconds to wait for the GCE metadata server when detecting the
# GCE environment.
try:
_METADATA_DEFAULT_TIMEOUT = int(os.getenv("GCE_METADATA_TIMEOUT", 3))
_METADATA_DEFAULT_TIMEOUT = int(os.getenv(environment_vars.GCE_METADATA_TIMEOUT, 3))
except ValueError: # pragma: NO COVER
_METADATA_DEFAULT_TIMEOUT = 3

Expand Down
5 changes: 5 additions & 0 deletions google/auth/environment_vars.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@
"""Environment variable providing an alternate ip:port to be used for ip-only
GCE metadata requests."""

GCE_METADATA_TIMEOUT = "GCE_METADATA_TIMEOUT"
"""Environment variable defining the timeout in seconds to wait for the
GCE metadata server when detecting the GCE environment.
"""

GCE_METADATA_DETECT_RETRIES = "GCE_METADATA_DETECT_RETRIES"
"""Environment variable representing the number of retries that should be
attempted on metadata lookup.
Expand Down

0 comments on commit e91f78b

Please sign in to comment.