xds.go 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /*
  2. *
  3. * Copyright 2020 gRPC authors.
  4. *
  5. * Licensed under the Apache License, Version 2.0 (the "License");
  6. * you may not use this file except in compliance with the License.
  7. * You may obtain a copy of the License at
  8. *
  9. * http://www.apache.org/licenses/LICENSE-2.0
  10. *
  11. * Unless required by applicable law or agreed to in writing, software
  12. * distributed under the License is distributed on an "AS IS" BASIS,
  13. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. * See the License for the specific language governing permissions and
  15. * limitations under the License.
  16. *
  17. */
  18. package envconfig
  19. import (
  20. "os"
  21. )
  22. const (
  23. // XDSBootstrapFileNameEnv is the env variable to set bootstrap file name.
  24. // Do not use this and read from env directly. Its value is read and kept in
  25. // variable XDSBootstrapFileName.
  26. //
  27. // When both bootstrap FileName and FileContent are set, FileName is used.
  28. XDSBootstrapFileNameEnv = "GRPC_XDS_BOOTSTRAP"
  29. // XDSBootstrapFileContentEnv is the env variable to set bootstrap file
  30. // content. Do not use this and read from env directly. Its value is read
  31. // and kept in variable XDSBootstrapFileContent.
  32. //
  33. // When both bootstrap FileName and FileContent are set, FileName is used.
  34. XDSBootstrapFileContentEnv = "GRPC_XDS_BOOTSTRAP_CONFIG"
  35. )
  36. var (
  37. // XDSBootstrapFileName holds the name of the file which contains xDS
  38. // bootstrap configuration. Users can specify the location of the bootstrap
  39. // file by setting the environment variable "GRPC_XDS_BOOTSTRAP".
  40. //
  41. // When both bootstrap FileName and FileContent are set, FileName is used.
  42. XDSBootstrapFileName = os.Getenv(XDSBootstrapFileNameEnv)
  43. // XDSBootstrapFileContent holds the content of the xDS bootstrap
  44. // configuration. Users can specify the bootstrap config by setting the
  45. // environment variable "GRPC_XDS_BOOTSTRAP_CONFIG".
  46. //
  47. // When both bootstrap FileName and FileContent are set, FileName is used.
  48. XDSBootstrapFileContent = os.Getenv(XDSBootstrapFileContentEnv)
  49. // C2PResolverTestOnlyTrafficDirectorURI is the TD URI for testing.
  50. C2PResolverTestOnlyTrafficDirectorURI = os.Getenv("GRPC_TEST_ONLY_GOOGLE_C2P_RESOLVER_TRAFFIC_DIRECTOR_URI")
  51. )