From: Stephane Gamard Date: Tue, 5 Aug 2014 13:40:46 +0000 (+0200) Subject: SONAR-5483 - Only allow http console for in-memory ES for MediumTests X-Git-Tag: 4.5-RC1~244 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=6fda70f66f0e3b20ef8dc7ff3129dd4dde21f73d;p=sonarqube.git SONAR-5483 - Only allow http console for in-memory ES for MediumTests --- diff --git a/server/sonar-server/src/main/java/org/sonar/server/search/ESNode.java b/server/sonar-server/src/main/java/org/sonar/server/search/ESNode.java index 2e06e7b9cee..fc3f54537bd 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/search/ESNode.java +++ b/server/sonar-server/src/main/java/org/sonar/server/search/ESNode.java @@ -136,7 +136,6 @@ public class ESNode implements Startable { initMemoryES(esSettings); } - initRestConsole(esSettings); initNetwork(esSettings); node = NodeBuilder.nodeBuilder() @@ -182,7 +181,15 @@ public class ESNode implements Startable { .put("path.logs", esLogDir().getAbsolutePath()); - + int httpPort = settings.getInt(IndexProperties.HTTP_PORT); + if (httpPort > 0) { + LOG.warn("Elasticsearch HTTP console enabled on port {}. Only for debugging purpose.", httpPort); + builder.put(HTTP_ENABLED, true); + builder.put("http.host", "127.0.0.1"); + builder.put("http.port", httpPort); + } else { + builder.put(HTTP_ENABLED, false); + } } private void addIndexTemplates() { @@ -255,18 +262,6 @@ public class ESNode implements Startable { esSettings.put("network.bind_host", "127.0.0.1"); } - private void initRestConsole(ImmutableSettings.Builder esSettings) { - int httpPort = settings.getInt(IndexProperties.HTTP_PORT); - if (httpPort > 0) { - LOG.warn("Elasticsearch HTTP console enabled on port {}. Only for debugging purpose.", httpPort); - esSettings.put(HTTP_ENABLED, true); - esSettings.put("http.host", "127.0.0.1"); - esSettings.put("http.port", httpPort); - } else { - esSettings.put(HTTP_ENABLED, false); - } - } - private File esHomeDir() { if (!settings.hasKey("sonar.path.home")) { throw new IllegalStateException("property 'sonar.path.home' is required");