Skip to content

Commit d658bcd

Browse files
committed
read env
1 parent bd3714f commit d658bcd

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

java-spanner/google-cloud-spanner/src/main/java/com/google/cloud/spanner/SpannerOptions.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -981,9 +981,11 @@ protected SpannerOptions(Builder builder) {
981981
} else {
982982
enableBuiltInMetrics = builder.enableBuiltInMetrics;
983983
}
984-
if (builder.experimentalHost != null
985-
&& System.getenv(EXPERIMENTAL_LOCATION_API_ENV_VAR) == null) {
986-
enableLocationApi = true;
984+
// Enable location API when experimental host is set, unless explicitly disabled
985+
// via GOOGLE_SPANNER_EXPERIMENTAL_LOCATION_API=false.
986+
if (builder.experimentalHost != null) {
987+
String locationApiEnvValue = System.getenv(EXPERIMENTAL_LOCATION_API_ENV_VAR);
988+
enableLocationApi = locationApiEnvValue == null || Boolean.parseBoolean(locationApiEnvValue);
987989
} else {
988990
enableLocationApi = builder.enableLocationApi;
989991
}

0 commit comments

Comments
 (0)