Commit 4cb1135b authored by Marco Descher's avatar Marco Descher
Browse files

[16515] Load EE_RC_ES_INTEGRATION_WEBHOOK_TOKEN, Context#IS_ELEXIS_SERV

parent f0aa99d4
Loading
Loading
Loading
Loading
+13 −3
Original line number Diff line number Diff line
@@ -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;
+1 −0
Original line number Diff line number Diff line
@@ -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