@@ -409,20 +409,22 @@ def client_cert_callback():
409409
410410def check_use_client_cert ():
411411 """Returns the value of the GOOGLE_API_USE_CLIENT_CERTIFICATE variable,
412- or an inferred 'true' or 'false' value if unset.
412+ or an inferred value( 'true' or 'false') if unset.
413413
414- The function checks the value of GOOGLE_API_USE_CLIENT_CERTIFICATE
415- environment variable, and GOOGLE_API_CERTIFICATE_CONFIG environment variable
416- if the former is not set. If GOOGLE_API_USE_CLIENT_CERTIFICATE is set,
417- this helper function returns the value of the former. If it is unset, this
418- helper function checks if GOOGLE_API_CERTIFICATE_CONFIG is set. If it is set,
419- this helper function returns "true" if the certificate config file contains
420- "workload" section and "false" otherwise.
414+ This value is meant to be interpreted as a "true" or "false" value
415+ representing whether the client certificate should be used, but could be any
416+ arbitrary string.
417+
418+ If GOOGLE_API_USE_CLIENT_CERTIFICATE is unset, the value value will be
419+ inferred by reading a file pointed at by GOOGLE_API_CERTIFICATE_CONFIG, and
420+ verifying it contains a "workload" section. If so, the function will return
421+ "true", otherwise "false".
421422
422423 Returns:
423- str: A string("true" or "false" or value of the
424- GOOGLE_API_USE_CLIENT_CERTIFICATE variable set) indicating if client
425- certificate should be used.
424+ str: The value of GOOGLE_API_USE_CLIENT_CERTIFICATE, or an inferred value
425+ ("true" or "false") if unset. This string should contain a value, but may
426+ be an any arbitrary string read from the user's set
427+ GOOGLE_API_USE_CLIENT_CERTIFICATE.
426428 """
427429 use_client_cert = getenv ("GOOGLE_API_USE_CLIENT_CERTIFICATE" )
428430 # Check if the value of GOOGLE_API_USE_CLIENT_CERTIFICATE is set.
@@ -446,5 +448,4 @@ def check_use_client_cert():
446448 json .JSONDecodeError ,
447449 ) as e :
448450 _LOGGER .debug ("error decoding certificate: %s" , e )
449- return "false"
450451 return "false"
0 commit comments