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
19package envconfig
20
21import (
22 "os"
23)
24
25const (
26 // XDSBootstrapFileNameEnv is the env variable to set bootstrap file name.
27 // Do not use this and read from env directly. Its value is read and kept in
28 // variable XDSBootstrapFileName.
29 //
30 // When both bootstrap FileName and FileContent are set, FileName is used.
31 XDSBootstrapFileNameEnv = "GRPC_XDS_BOOTSTRAP"
32 // XDSBootstrapFileContentEnv is the env variable to set bootstrap file
33 // content. Do not use this and read from env directly. Its value is read
34 // and kept in variable XDSBootstrapFileContent.
35 //
36 // When both bootstrap FileName and FileContent are set, FileName is used.
37 XDSBootstrapFileContentEnv = "GRPC_XDS_BOOTSTRAP_CONFIG"
38)
39
40var (
41 // XDSBootstrapFileName holds the name of the file which contains xDS
42 // bootstrap configuration. Users can specify the location of the bootstrap
43 // file by setting the environment variable "GRPC_XDS_BOOTSTRAP".
44 //
45 // When both bootstrap FileName and FileContent are set, FileName is used.
46 XDSBootstrapFileName = os.Getenv(XDSBootstrapFileNameEnv)
47 // XDSBootstrapFileContent holds the content of the xDS bootstrap
48 // configuration. Users can specify the bootstrap config by setting the
49 // environment variable "GRPC_XDS_BOOTSTRAP_CONFIG".
50 //
51 // When both bootstrap FileName and FileContent are set, FileName is used.
52 XDSBootstrapFileContent = os.Getenv(XDSBootstrapFileContentEnv)
53
54 // C2PResolverTestOnlyTrafficDirectorURI is the TD URI for testing.
55 C2PResolverTestOnlyTrafficDirectorURI = os.Getenv("GRPC_TEST_ONLY_GOOGLE_C2P_RESOLVER_TRAFFIC_DIRECTOR_URI")
56
57 // XDSDualstackEndpointsEnabled is true if gRPC should read the
58 // "additional addresses" in the xDS endpoint resource.
59 XDSDualstackEndpointsEnabled = boolFromEnv("GRPC_EXPERIMENTAL_XDS_DUALSTACK_ENDPOINTS", true)
60
61 // XDSSystemRootCertsEnabled is true when xDS enabled gRPC clients can use
62 // the system's default root certificates for TLS certificate validation.
63 // For more details, see:
64 // https://github.com/grpc/proposal/blob/master/A82-xds-system-root-certs.md.
65 XDSSystemRootCertsEnabled = boolFromEnv("GRPC_EXPERIMENTAL_XDS_SYSTEM_ROOT_CERTS", false)
66)