blob: 02b4b6a1c10969407562cc2c78067c2cba9ed3f2 [file] [log] [blame]
khenaidoo257f3192021-12-15 16:46:37 -05001/*
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"
khenaidoo257f3192021-12-15 16:46:37 -050023)
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
Akash Kankanala761955c2024-02-21 19:32:20 +053028 // variable XDSBootstrapFileName.
khenaidoo257f3192021-12-15 16:46:37 -050029 //
30 // When both bootstrap FileName and FileContent are set, FileName is used.
31 XDSBootstrapFileNameEnv = "GRPC_XDS_BOOTSTRAP"
Akash Kankanala761955c2024-02-21 19:32:20 +053032 // XDSBootstrapFileContentEnv is the env variable to set bootstrap file
khenaidoo257f3192021-12-15 16:46:37 -050033 // content. Do not use this and read from env directly. Its value is read
Akash Kankanala761955c2024-02-21 19:32:20 +053034 // and kept in variable XDSBootstrapFileContent.
khenaidoo257f3192021-12-15 16:46:37 -050035 //
36 // When both bootstrap FileName and FileContent are set, FileName is used.
37 XDSBootstrapFileContentEnv = "GRPC_XDS_BOOTSTRAP_CONFIG"
khenaidoo257f3192021-12-15 16:46:37 -050038)
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 // XDSRingHash indicates whether ring hash support is enabled, which can be
54 // disabled by setting the environment variable
55 // "GRPC_XDS_EXPERIMENTAL_ENABLE_RING_HASH" to "false".
Akash Kankanala761955c2024-02-21 19:32:20 +053056 XDSRingHash = boolFromEnv("GRPC_XDS_EXPERIMENTAL_ENABLE_RING_HASH", true)
khenaidoo257f3192021-12-15 16:46:37 -050057 // XDSClientSideSecurity is used to control processing of security
58 // configuration on the client-side.
59 //
60 // Note that there is no env var protection for the server-side because we
61 // have a brand new API on the server-side and users explicitly need to use
62 // the new API to get security integration on the server.
Akash Kankanala761955c2024-02-21 19:32:20 +053063 XDSClientSideSecurity = boolFromEnv("GRPC_XDS_EXPERIMENTAL_SECURITY_SUPPORT", true)
64 // XDSAggregateAndDNS indicates whether processing of aggregated cluster and
65 // DNS cluster is enabled, which can be disabled by setting the environment
66 // variable "GRPC_XDS_EXPERIMENTAL_ENABLE_AGGREGATE_AND_LOGICAL_DNS_CLUSTER"
67 // to "false".
68 XDSAggregateAndDNS = boolFromEnv("GRPC_XDS_EXPERIMENTAL_ENABLE_AGGREGATE_AND_LOGICAL_DNS_CLUSTER", true)
khenaidoo257f3192021-12-15 16:46:37 -050069
70 // XDSRBAC indicates whether xDS configured RBAC HTTP Filter is enabled,
71 // which can be disabled by setting the environment variable
72 // "GRPC_XDS_EXPERIMENTAL_RBAC" to "false".
Akash Kankanala761955c2024-02-21 19:32:20 +053073 XDSRBAC = boolFromEnv("GRPC_XDS_EXPERIMENTAL_RBAC", true)
74 // XDSOutlierDetection indicates whether outlier detection support is
75 // enabled, which can be disabled by setting the environment variable
76 // "GRPC_EXPERIMENTAL_ENABLE_OUTLIER_DETECTION" to "false".
77 XDSOutlierDetection = boolFromEnv("GRPC_EXPERIMENTAL_ENABLE_OUTLIER_DETECTION", true)
78 // XDSFederation indicates whether federation support is enabled, which can
79 // be enabled by setting the environment variable
80 // "GRPC_EXPERIMENTAL_XDS_FEDERATION" to "true".
81 XDSFederation = boolFromEnv("GRPC_EXPERIMENTAL_XDS_FEDERATION", true)
khenaidoo257f3192021-12-15 16:46:37 -050082
83 // XDSRLS indicates whether processing of Cluster Specifier plugins and
Akash Kankanala761955c2024-02-21 19:32:20 +053084 // support for the RLS CLuster Specifier is enabled, which can be disabled by
khenaidoo257f3192021-12-15 16:46:37 -050085 // setting the environment variable "GRPC_EXPERIMENTAL_XDS_RLS_LB" to
Akash Kankanala761955c2024-02-21 19:32:20 +053086 // "false".
87 XDSRLS = boolFromEnv("GRPC_EXPERIMENTAL_XDS_RLS_LB", true)
khenaidoo257f3192021-12-15 16:46:37 -050088
89 // C2PResolverTestOnlyTrafficDirectorURI is the TD URI for testing.
Akash Kankanala761955c2024-02-21 19:32:20 +053090 C2PResolverTestOnlyTrafficDirectorURI = os.Getenv("GRPC_TEST_ONLY_GOOGLE_C2P_RESOLVER_TRAFFIC_DIRECTOR_URI")
91 // XDSCustomLBPolicy indicates whether Custom LB Policies are enabled, which
92 // can be disabled by setting the environment variable
93 // "GRPC_EXPERIMENTAL_XDS_CUSTOM_LB_CONFIG" to "false".
94 XDSCustomLBPolicy = boolFromEnv("GRPC_EXPERIMENTAL_XDS_CUSTOM_LB_CONFIG", true)
khenaidoo257f3192021-12-15 16:46:37 -050095)