Skip to content

Commit

Permalink
Merge pull request #124 from mesos/bug/124-fixed-port
Browse files Browse the repository at this point in the history
Logstash framework uses 8080 port (file server)
  • Loading branch information
mwl committed Mar 31, 2016
2 parents 9287ef5 + bf1ccc5 commit 5b64d3d
Showing 1 changed file with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
package org.apache.mesos.logstash.config;

import org.apache.mesos.logstash.common.network.NetworkUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.embedded.EmbeddedServletContainerInitializedEvent;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.ApplicationListener;
import org.springframework.stereotype.Component;

import javax.inject.Inject;
Expand All @@ -10,8 +13,7 @@

@Component
@ConfigurationProperties
public class FrameworkConfig {

public class FrameworkConfig implements ApplicationListener<EmbeddedServletContainerInitializedEvent> {
private static final String LOGSTASH_EXECUTOR_JAR = "logstash-mesos-executor.jar";

private static final String LOGSTASH_TARBALL = "logstash.tar.gz";
Expand All @@ -21,6 +23,13 @@ public class FrameworkConfig {
@Inject
private NetworkUtils networkUtils;

int httpPort;

@Override
public void onApplicationEvent(EmbeddedServletContainerInitializedEvent event) {
httpPort = event.getEmbeddedServletContainer().getPort();
}

public String getJavaHome() {
if (!javaHome.isEmpty()) {
return javaHome.replaceAll("java$", "").replaceAll("/$", "") + "/";
Expand All @@ -34,7 +43,7 @@ public void setJavaHome(String javaHome) {
}

public String getFrameworkFileServerAddress() {
return networkUtils.addressToString(networkUtils.hostSocket(8080), true);
return networkUtils.addressToString(networkUtils.hostSocket(httpPort), true);
}

public String getLogstashTarballUri() {
Expand Down

0 comments on commit 5b64d3d

Please sign in to comment.