From 6fda70f66f0e3b20ef8dc7ff3129dd4dde21f73d Mon Sep 17 00:00:00 2001 From: Stephane Gamard Date: Tue, 5 Aug 2014 15:40:46 +0200 Subject: [PATCH] SONAR-5483 - Only allow http console for in-memory ES for MediumTests --- .../java/org/sonar/server/search/ESNode.java | 23 ++++++++----------- 1 file changed, 9 insertions(+), 14 deletions(-) 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"); -- 2.39.5