|
9 | 9 | import java.util.Set; |
10 | 10 | import java.util.concurrent.TimeUnit; |
11 | 11 | import java.util.stream.Collectors; |
| 12 | + |
12 | 13 | import jakarta.inject.Inject; |
13 | 14 | import jakarta.inject.Named; |
14 | 15 | import org.apache.commons.collections4.CollectionUtils; |
|
26 | 27 | import org.slf4j.LoggerFactory; |
27 | 28 | import org.springframework.context.annotation.Lazy; |
28 | 29 | import org.springframework.scheduling.support.CronExpression; |
| 30 | + |
29 | 31 | import static java.text.MessageFormat.format; |
30 | 32 |
|
31 | 33 | @Named |
@@ -99,6 +101,7 @@ public class ApplicationConfiguration { |
99 | 101 | static final String CFG_THREADS_FOR_FILE_UPLOAD_TO_CONTROLLER = "THREADS_FOR_FILE_UPLOAD_TO_CONTROLLER"; |
100 | 102 | static final String CFG_THREADS_FOR_FILE_STORAGE_UPLOAD = "THREADS_FOR_FILE_STORAGE_UPLOAD"; |
101 | 103 | static final String CFG_IS_HEALTH_CHECK_ENABLED = "IS_HEALTH_CHECK_ENABLED"; |
| 104 | + static final String USE_LEGACY_ROUTE_WARNING = "USE_LEGACY_ROUTE_WARNING"; |
102 | 105 |
|
103 | 106 | private static final List<String> VCAP_APPLICATION_URIS_KEYS = List.of("full_application_uris", "application_uris", "uris"); |
104 | 107 |
|
@@ -158,6 +161,7 @@ public class ApplicationConfiguration { |
158 | 161 | public static final int DEFAULT_THREADS_FOR_FILE_STORAGE_UPLOAD = 7; |
159 | 162 | public static final boolean DEFAULT_IS_HEALTH_CHECK_ENABLED = false; |
160 | 163 | public static final Boolean DEFAULT_IS_READINESS_HEALTH_CHECK_ENABLED = Boolean.FALSE; |
| 164 | + public static final Boolean DEFAULT_USE_LEGACY_ROUTE_WARNING = false; |
161 | 165 |
|
162 | 166 | protected final Environment environment; |
163 | 167 |
|
@@ -218,6 +222,7 @@ public class ApplicationConfiguration { |
218 | 222 | private Boolean isHealthCheckEnabled; |
219 | 223 | private Set<String> objectStoreRegions; |
220 | 224 | private Boolean isReadinessHealthCheckEnabled; |
| 225 | + private Boolean useLegacyRouteWarning; |
221 | 226 |
|
222 | 227 | public ApplicationConfiguration() { |
223 | 228 | this(new Environment()); |
@@ -500,6 +505,13 @@ public String getObjectStoreClientType() { |
500 | 505 | return objectStoreClientType; |
501 | 506 | } |
502 | 507 |
|
| 508 | + public Boolean getLegacyRouteWarningEnablement() { |
| 509 | + if (useLegacyRouteWarning == null) { |
| 510 | + useLegacyRouteWarning = getLegacyRouteWarningEnablementFromEnvironment(); |
| 511 | + } |
| 512 | + return useLegacyRouteWarning; |
| 513 | + } |
| 514 | + |
503 | 515 | public HealthCheckConfiguration getHealthCheckConfiguration() { |
504 | 516 | if (healthCheckConfiguration == null) { |
505 | 517 | healthCheckConfiguration = getHealthCheckConfigurationFromEnvironment(); |
@@ -916,6 +928,12 @@ private String getObjectStoreClientTypeFromEnvironment() { |
916 | 928 | return value; |
917 | 929 | } |
918 | 930 |
|
| 931 | + private Boolean getLegacyRouteWarningEnablementFromEnvironment() { |
| 932 | + Boolean value = environment.getBoolean(USE_LEGACY_ROUTE_WARNING, DEFAULT_USE_LEGACY_ROUTE_WARNING); |
| 933 | + logEnvironmentVariable(USE_LEGACY_ROUTE_WARNING, Messages.USE_LEGACY_ROUTE_WARNING, value); |
| 934 | + return value; |
| 935 | + } |
| 936 | + |
919 | 937 | private HealthCheckConfiguration getHealthCheckConfigurationFromEnvironment() { |
920 | 938 | HealthCheckConfiguration healthCheckConfigurationFromEnvironment = ImmutableHealthCheckConfiguration.builder() |
921 | 939 | .spaceId( |
|
0 commit comments