File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed
google-cloud-spanner/src/main/java/com/google/cloud/spanner/spi/v1 Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -368,10 +368,12 @@ public GapicSpannerRpc(final SpannerOptions options) {
368368 boolean isEnableDirectAccess = options .isEnableDirectAccess ();
369369 if (isEnableDirectAccess ) {
370370 defaultChannelProviderBuilder .setAttemptDirectPath (true );
371- // This will let the credentials try to fetch a hard-bound access token if the runtime
372- // environment supports it.
373- defaultChannelProviderBuilder .setAllowHardBoundTokenTypes (
374- Collections .singletonList (InstantiatingGrpcChannelProvider .HardBoundTokenTypes .ALTS ));
371+ if (isEnableDirectPathBoundToken ()) {
372+ // This will let the credentials try to fetch a hard-bound access token if the runtime
373+ // environment supports it.
374+ defaultChannelProviderBuilder .setAllowHardBoundTokenTypes (
375+ Collections .singletonList (InstantiatingGrpcChannelProvider .HardBoundTokenTypes .ALTS ));
376+ }
375377 defaultChannelProviderBuilder .setAttemptDirectPathXds ();
376378 }
377379
@@ -687,6 +689,10 @@ public static boolean isEnableDirectPathXdsEnv() {
687689 return Boolean .parseBoolean (System .getenv ("GOOGLE_SPANNER_ENABLE_DIRECT_ACCESS" ));
688690 }
689691
692+ public static boolean isEnableDirectPathBoundToken () {
693+ return !Boolean .parseBoolean (System .getenv ("GOOGLE_SPANNER_DISABLE_DIRECT_ACCESS_BOUND_TOKEN" ));
694+ }
695+
690696 private static final RetrySettings ADMIN_REQUESTS_LIMIT_EXCEEDED_RETRY_SETTINGS =
691697 RetrySettings .newBuilder ()
692698 .setInitialRetryDelayDuration (Duration .ofSeconds (5L ))
You can’t perform that action at this time.
0 commit comments