From 2b369f9ef96adc19c31aa7cc2c6e6376c515b43f Mon Sep 17 00:00:00 2001 From: Andy Taylor Date: Wed, 1 Mar 2017 10:19:49 +0000 Subject: [PATCH] ARTEMIS-1008 - Allow web server host to be set on create https://issues.apache.org/jira/browse/ARTEMIS-1008 --- .../org/apache/activemq/artemis/cli/commands/Create.java | 6 ++++++ .../artemis/cli/commands/etc/bootstrap-web-settings.txt | 2 +- .../test/java/org/apache/activemq/cli/test/ArtemisTest.java | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/Create.java b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/Create.java index cd42f808d2..5dae3c9840 100644 --- a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/Create.java +++ b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/Create.java @@ -60,6 +60,8 @@ public class Create extends InputAbstract { private static final Integer HQ_PORT = 5445; + public static final String HTTP_HOST = "localhost"; + public static final Integer HTTP_PORT = 8161; private static final Integer MQTT_PORT = 1883; @@ -105,6 +107,9 @@ public class Create extends InputAbstract { @Option(name = "--host", description = "The host name of the broker (Default: 0.0.0.0 or input if clustered)") String host; + @Option(name = "--http-host", description = "The host name to use for embedded web server (Default: localhost)") + String httpHost = HTTP_HOST; + @Option(name = "--ping", description = "A comma separated string to be passed on to the broker config as network-check-list. The broker will shutdown when all these addresses are unreachable.") String ping; @@ -631,6 +636,7 @@ public class Create extends InputAbstract { filters.put("${stomp.port}", String.valueOf(STOMP_PORT + portOffset)); filters.put("${hq.port}", String.valueOf(HQ_PORT + portOffset)); filters.put("${mqtt.port}", String.valueOf(MQTT_PORT + portOffset)); + filters.put("${http.host}", httpHost); filters.put("${http.port}", String.valueOf(httpPort + portOffset)); filters.put("${data.dir}", data); filters.put("${max-hops}", String.valueOf(maxHops)); diff --git a/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/bootstrap-web-settings.txt b/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/bootstrap-web-settings.txt index 946b485415..c4d83c8f6b 100644 --- a/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/bootstrap-web-settings.txt +++ b/artemis-cli/src/main/resources/org/apache/activemq/artemis/cli/commands/etc/bootstrap-web-settings.txt @@ -1,4 +1,4 @@ - + diff --git a/artemis-cli/src/test/java/org/apache/activemq/cli/test/ArtemisTest.java b/artemis-cli/src/test/java/org/apache/activemq/cli/test/ArtemisTest.java index 72e2ca3db3..803020c6fd 100644 --- a/artemis-cli/src/test/java/org/apache/activemq/cli/test/ArtemisTest.java +++ b/artemis-cli/src/test/java/org/apache/activemq/cli/test/ArtemisTest.java @@ -157,7 +157,7 @@ public class ArtemisTest extends CliTestBase { Element webElem = (Element) config.getElementsByTagName("web").item(0); String bindAttr = webElem.getAttribute("bind"); - String bindStr = "http://localhost:" + Create.HTTP_PORT; + String bindStr = "http://" + Create.HTTP_HOST + ":" + Create.HTTP_PORT; assertEquals(bindAttr, bindStr); //no any of those