Skip to content

Commit 47851e8

Browse files
authored
feat: remove directpath enable env (#1657)
1 parent 6672a50 commit 47851e8

File tree

1 file changed

+2
-17
lines changed

1 file changed

+2
-17
lines changed

gax-java/gax-grpc/src/main/java/com/google/api/gax/grpc/InstantiatingGrpcChannelProvider.java

+2-17
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@
8282
*/
8383
@InternalExtensionOnly
8484
public final class InstantiatingGrpcChannelProvider implements TransportChannelProvider {
85-
static final String DIRECT_PATH_ENV_VAR = "GOOGLE_CLOUD_ENABLE_DIRECT_PATH";
8685
private static final String DIRECT_PATH_ENV_DISABLE_DIRECT_PATH =
8786
"GOOGLE_CLOUD_DISABLE_DIRECT_PATH";
8887
private static final String DIRECT_PATH_ENV_ENABLE_XDS = "GOOGLE_CLOUD_ENABLE_DIRECT_PATH_XDS";
@@ -237,9 +236,7 @@ private TransportChannel createChannel() throws IOException {
237236
channelPoolSettings, InstantiatingGrpcChannelProvider.this::createSingleChannel));
238237
}
239238

240-
// TODO(mohanli): Use attemptDirectPath as the only indicator once setAttemptDirectPath is adapted
241-
// and the env var is removed from client environment.
242-
private boolean isDirectPathEnabled(String serviceAddress) {
239+
private boolean isDirectPathEnabled() {
243240
String disableDirectPathEnv = envProvider.getenv(DIRECT_PATH_ENV_DISABLE_DIRECT_PATH);
244241
boolean isDirectPathDisabled = Boolean.parseBoolean(disableDirectPathEnv);
245242
if (isDirectPathDisabled) {
@@ -249,16 +246,6 @@ private boolean isDirectPathEnabled(String serviceAddress) {
249246
if (attemptDirectPath != null) {
250247
return attemptDirectPath;
251248
}
252-
// Only check DIRECT_PATH_ENV_VAR when attemptDirectPath is not set.
253-
String whiteList = envProvider.getenv(DIRECT_PATH_ENV_VAR);
254-
if (whiteList == null) {
255-
return false;
256-
}
257-
for (String service : whiteList.split(",")) {
258-
if (!service.isEmpty() && serviceAddress.contains(service)) {
259-
return true;
260-
}
261-
}
262249
return false;
263250
}
264251

@@ -318,9 +305,7 @@ private ManagedChannel createSingleChannel() throws IOException {
318305

319306
// Check DirectPath traffic.
320307
boolean isDirectPathXdsEnabled = false;
321-
if (isDirectPathEnabled(serviceAddress)
322-
&& isNonDefaultServiceAccountAllowed()
323-
&& isOnComputeEngine()) {
308+
if (isDirectPathEnabled() && isNonDefaultServiceAccountAllowed() && isOnComputeEngine()) {
324309
CallCredentials callCreds = MoreCallCredentials.from(credentials);
325310
ChannelCredentials channelCreds =
326311
GoogleDefaultChannelCredentials.newBuilder().callCredentials(callCreds).build();

0 commit comments

Comments
 (0)