Commit 17d7822e authored by Marco Descher's avatar Marco Descher

[17024] Cleanup, add keycloak base url

parent d28442df
Pipeline #12489 passed with stages
in 4 minutes and 46 seconds
......@@ -16,28 +16,24 @@ import ch.elexis.core.eenv.IElexisEnvironmentService;
import ch.elexis.core.services.IConfigService;
/**
* Programmatically register the {@link ElexisEnvironmentService} if conditions are met. That is,
* an Elexis-Environment host value is passed.
* Programmatically register the {@link ElexisEnvironmentService} if conditions are met. That is, an
* Elexis-Environment host value is passed.
*/
@Component
public class ElexisEnvironmentServiceActivator {
private ServiceRegistration<IElexisEnvironmentService> serviceRegistration;
private String elexisEnvironmentHost;
private Logger log = LoggerFactory.getLogger(getClass());
@Reference
private IConfigService configService;
@Activate
public void activate(){
// 1. try via system property
elexisEnvironmentHost =
String elexisEnvironmentHost =
System.getProperty(ElexisSystemPropertyConstants.EE_HOSTNAME);
// 2. if empty fetch via environment variable
if(StringUtils.isBlank(elexisEnvironmentHost)) {
if (StringUtils.isBlank(elexisEnvironmentHost)) {
elexisEnvironmentHost = System.getenv(ElexisEnvironmentPropertyConstants.EE_HOSTNAME);
}
// 3. if empty fetch via config service
......@@ -46,12 +42,13 @@ public class ElexisEnvironmentServiceActivator {
configService.get(IElexisEnvironmentService.CFG_EE_HOSTNAME, null);
}
Logger log = LoggerFactory.getLogger(getClass());
if (StringUtils.isNotBlank(elexisEnvironmentHost)) {
try {
// activate the service
ElexisEnvironmentService elexisEnvironmentService = new ElexisEnvironmentService(
elexisEnvironmentHost);
ElexisEnvironmentService elexisEnvironmentService =
new ElexisEnvironmentService(elexisEnvironmentHost);
serviceRegistration =
FrameworkUtil.getBundle(ElexisEnvironmentServiceActivator.class)
.getBundleContext().registerService(IElexisEnvironmentService.class,
......@@ -63,6 +60,7 @@ public class ElexisEnvironmentServiceActivator {
} catch (Exception e) {
log.warn("Initializing elexis-environment failed", e);
}
} else {
log.debug("No elexis-environment configured");
}
......
......@@ -39,4 +39,8 @@ public interface IElexisEnvironmentService {
return getBaseUrl() + "/bookstack";
}
default String getKeycloakBaseUrl(){
return getBaseUrl() + "/keycloak";
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment