Skip to content

Commit 33713ff

Browse files
committed
feat: add GCE_METADATA_DETECT_RETRIES to environment_vars.py
1 parent 037c367 commit 33713ff

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

google/auth/compute_engine/_metadata.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
# Timeout in seconds to wait for the GCE metadata server when detecting the
5555
# GCE environment.
5656
try:
57-
_METADATA_DEFAULT_TIMEOUT = int(os.getenv("GCE_METADATA_TIMEOUT", 3))
57+
_METADATA_DEFAULT_TIMEOUT = int(os.getenv(environment_vars.GCE_METADATA_TIMEOUT, 3))
5858
except ValueError: # pragma: NO COVER
5959
_METADATA_DEFAULT_TIMEOUT = 3
6060

google/auth/environment_vars.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,11 @@
6060
"""Environment variable providing an alternate ip:port to be used for ip-only
6161
GCE metadata requests."""
6262

63+
GCE_METADATA_TIMEOUT = "GCE_METADATA_TIMEOUT"
64+
"""Environment variable defining the timeout in seconds to wait for the
65+
GCE metadata server when detecting the GCE environment.
66+
"""
67+
6368
GCE_METADATA_DETECT_RETRIES = "GCE_METADATA_DETECT_RETRIES"
6469
"""Environment variable representing the number of retries that should be
6570
attempted on metadata lookup.

0 commit comments

Comments
 (0)