Skip to content

Commit 7522a19

Browse files
committed
fix: add source tracking for explicit mtls cert path
1 parent bb69aa9 commit 7522a19

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

packages/google-auth/google/auth/transport/_mtls_helper.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -416,18 +416,23 @@ def _get_cert_config_path(certificate_config_path=None, include_context_aware=Tr
416416
The absolute path of the certificate config file, and None if the file does not exist.
417417
"""
418418

419+
source = "function argument"
419420
is_explicit = True
420421
if certificate_config_path is None:
421422
env_path = environ.get(environment_vars.GOOGLE_API_CERTIFICATE_CONFIG, None)
422423
if env_path is not None and env_path != "":
423424
certificate_config_path = env_path
425+
source = (
426+
f"environment variable {environment_vars.GOOGLE_API_CERTIFICATE_CONFIG}"
427+
)
424428
else:
425429
env_path = environ.get(
426430
environment_vars.CLOUDSDK_CONTEXT_AWARE_CERTIFICATE_CONFIG_FILE_PATH,
427431
None,
428432
)
429433
if include_context_aware and env_path is not None and env_path != "":
430434
certificate_config_path = env_path
435+
source = f"environment variable {environment_vars.CLOUDSDK_CONTEXT_AWARE_CERTIFICATE_CONFIG_FILE_PATH}"
431436
else:
432437
certificate_config_path = CERTIFICATE_CONFIGURATION_DEFAULT_PATH
433438
is_explicit = False
@@ -436,7 +441,8 @@ def _get_cert_config_path(certificate_config_path=None, include_context_aware=Tr
436441
if not path.exists(certificate_config_path):
437442
if is_explicit:
438443
_LOGGER.debug(
439-
"Certificate configuration file at %s does not exist",
444+
"Certificate configuration file explicitly specified via %s at %s does not exist",
445+
source,
440446
certificate_config_path,
441447
)
442448
return None

0 commit comments

Comments
 (0)