environment_vars.py 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. # Copyright 2016 Google LLC
  2. #
  3. # Licensed under the Apache License, Version 2.0 (the "License");
  4. # you may not use this file except in compliance with the License.
  5. # You may obtain a copy of the License at
  6. #
  7. # http://www.apache.org/licenses/LICENSE-2.0
  8. #
  9. # Unless required by applicable law or agreed to in writing, software
  10. # distributed under the License is distributed on an "AS IS" BASIS,
  11. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. # See the License for the specific language governing permissions and
  13. # limitations under the License.
  14. """Environment variables used by :mod:`google.auth`."""
  15. PROJECT = "GOOGLE_CLOUD_PROJECT"
  16. """Environment variable defining default project.
  17. This used by :func:`google.auth.default` to explicitly set a project ID. This
  18. environment variable is also used by the Google Cloud Python Library.
  19. """
  20. LEGACY_PROJECT = "GCLOUD_PROJECT"
  21. """Previously used environment variable defining the default project.
  22. This environment variable is used instead of the current one in some
  23. situations (such as Google App Engine).
  24. """
  25. CREDENTIALS = "GOOGLE_APPLICATION_CREDENTIALS"
  26. """Environment variable defining the location of Google application default
  27. credentials."""
  28. # The environment variable name which can replace ~/.config if set.
  29. CLOUD_SDK_CONFIG_DIR = "CLOUDSDK_CONFIG"
  30. """Environment variable defines the location of Google Cloud SDK's config
  31. files."""
  32. # These two variables allow for customization of the addresses used when
  33. # contacting the GCE metadata service.
  34. GCE_METADATA_HOST = "GCE_METADATA_HOST"
  35. GCE_METADATA_ROOT = "GCE_METADATA_ROOT"
  36. """Environment variable providing an alternate hostname or host:port to be
  37. used for GCE metadata requests.
  38. This environment variable is originally named GCE_METADATA_ROOT. System will
  39. check the new variable first; should there be no value present,
  40. the system falls back to the old variable.
  41. """
  42. GCE_METADATA_IP = "GCE_METADATA_IP"
  43. """Environment variable providing an alternate ip:port to be used for ip-only
  44. GCE metadata requests."""
  45. GOOGLE_API_USE_CLIENT_CERTIFICATE = "GOOGLE_API_USE_CLIENT_CERTIFICATE"
  46. """Environment variable controlling whether to use client certificate or not.
  47. The default value is false. Users have to explicitly set this value to true
  48. in order to use client certificate to establish a mutual TLS channel."""
  49. LEGACY_APPENGINE_RUNTIME = "APPENGINE_RUNTIME"
  50. """Gen1 environment variable defining the App Engine Runtime.
  51. Used to distinguish between GAE gen1 and GAE gen2+.
  52. """
  53. # AWS environment variables used with AWS workload identity pools to retrieve
  54. # AWS security credentials and the AWS region needed to create a serialized
  55. # signed requests to the AWS STS GetCalledIdentity API that can be exchanged
  56. # for a Google access tokens via the GCP STS endpoint.
  57. # When not available the AWS metadata server is used to retrieve these values.
  58. AWS_ACCESS_KEY_ID = "AWS_ACCESS_KEY_ID"
  59. AWS_SECRET_ACCESS_KEY = "AWS_SECRET_ACCESS_KEY"
  60. AWS_SESSION_TOKEN = "AWS_SESSION_TOKEN"
  61. AWS_REGION = "AWS_REGION"
  62. AWS_DEFAULT_REGION = "AWS_DEFAULT_REGION"