Commit 4cb1135b authored by Marco Descher's avatar Marco Descher 🏔

[16515] Load EE_RC_ES_INTEGRATION_WEBHOOK_TOKEN, Context#IS_ELEXIS_SERV

parent f0aa99d4
Pipeline #11518 passed with stages
in 2 minutes and 23 seconds
......@@ -13,6 +13,11 @@ import ch.qos.logback.classic.LoggerContext;
import ch.qos.logback.classic.spi.ILoggingEvent;
import ch.qos.logback.core.Appender;
/**
* This service is programmatically activated via
*
* @see ElexisEnvironmentServiceActivator
*/
@Component
public class ElexisEnvironmentActivator {
......@@ -25,14 +30,19 @@ public class ElexisEnvironmentActivator {
@Activate
public void activate() {
String hostname = elexisEnvironmentService.getHostname();
activateRocketChatLogAppender(hostname);
// IS ROCKETCHAT ENABLED?
configureRocketchatIntegration(hostname);
}
private void activateRocketChatLogAppender(String hostname) {
private void configureRocketchatIntegration(String hostname) {
String rocketchatIntegrationToken = elexisEnvironmentService.getProperty("EE_RC_ES_INTEGRATION_WEBHOOK_TOKEN");
String rocketchatIntegrationUrl = "https://" + hostname + "/chat/hooks/" + rocketchatIntegrationToken;
// pass the integration token to RocketchatMessageTransporter
contextService.getRootContext().setNamed("rocketchat-station-integration-token", rocketchatIntegrationToken);
LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();
Logger slf4jRootLogger = lc.getLogger(org.slf4j.Logger.ROOT_LOGGER_NAME);
ch.qos.logback.classic.Logger rootLogger = (ch.qos.logback.classic.Logger) slf4jRootLogger;
......@@ -51,7 +61,7 @@ public class ElexisEnvironmentActivator {
asyncAppender.addAppender(rocketchatAppender);
asyncAppender.start();
rootLogger.addAppender(asyncAppender);
} else {
LoggerFactory.getLogger(getClass()).error("Could not get rocketchat appender from root logger");
}
......
......@@ -16,6 +16,7 @@ public class ContextService implements IContextService {
@Activate
public void activate(){
rootContext = new Context();
rootContext.setNamed("IS_ELEXIS_SERVER", Boolean.TRUE.toString());
}
@Override
......
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