|
21 | 21 | package eu.openanalytics.containerproxy; |
22 | 22 |
|
23 | 23 | import com.fasterxml.jackson.datatype.jsr353.JSR353Module; |
| 24 | +import eu.openanalytics.containerproxy.backend.dispatcher.proxysharing.ProxySharingDispatcher; |
| 25 | +import eu.openanalytics.containerproxy.model.spec.ProxySpec; |
24 | 26 | import eu.openanalytics.containerproxy.service.hearbeat.ActiveProxiesService; |
25 | 27 | import eu.openanalytics.containerproxy.service.hearbeat.HeartbeatService; |
26 | 28 | import eu.openanalytics.containerproxy.service.hearbeat.IHeartbeatProcessor; |
| 29 | +import eu.openanalytics.containerproxy.spec.IProxySpecProvider; |
27 | 30 | import eu.openanalytics.containerproxy.util.LoggingConfigurer; |
28 | 31 | import eu.openanalytics.containerproxy.util.ProxyMappingManager; |
29 | 32 | import io.undertow.Handlers; |
@@ -106,6 +109,8 @@ public class ContainerProxyApplication { |
106 | 109 | private DefaultCookieSerializer defaultCookieSerializer; |
107 | 110 | @Autowired(required = false) |
108 | 111 | private SessionManagerFactory sessionManagerFactory; |
| 112 | + @Inject |
| 113 | + private IProxySpecProvider proxySpecProvider; |
109 | 114 |
|
110 | 115 | public static void main(String[] args) { |
111 | 116 | SpringApplication app = new SpringApplication(ContainerProxyApplication.class); |
@@ -247,6 +252,14 @@ public void init() { |
247 | 252 | log.warn("WARNING: Invalid configuration detected: user sessions are stored in Redis and App Recovery is enabled. Instead of using App Recovery, change store-mode so that app sessions are stored in Redis!"); |
248 | 253 | } |
249 | 254 | } |
| 255 | + if (environment.getProperty(PROPERTY_RECOVER_RUNNING_PROXIES, Boolean.class, false) || |
| 256 | + environment.getProperty(PROPERTY_RECOVER_RUNNING_PROXIES_FROM_DIFFERENT_CONFIG, Boolean.class, false)) { |
| 257 | + for (ProxySpec proxySpec : proxySpecProvider.getSpecs()) { |
| 258 | + if (ProxySharingDispatcher.supportSpec(proxySpec)) { |
| 259 | + throw new IllegalStateException("Cannot use App Recovery together with container pre-initialization or sharing"); |
| 260 | + } |
| 261 | + } |
| 262 | + } |
250 | 263 |
|
251 | 264 | boolean hideSpecDetails = environment.getProperty(PROP_API_SECURITY_HIDE_SPEC_DETAILS, Boolean.class, true); |
252 | 265 | if (!hideSpecDetails) { |
|
0 commit comments