ARTEMIS-1008 - Allow web server host to be set on create

https://issues.apache.org/jira/browse/ARTEMIS-1008
This commit is contained in:
Andy Taylor 2017-03-01 10:19:49 +00:00
parent 70721dcd5c
commit 2b369f9ef9
3 changed files with 8 additions and 2 deletions

View File

@ -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));

View File

@ -1,4 +1,4 @@
<!-- The web server is only bound to loalhost by default -->
<web bind="${web.protocol}://localhost:${http.port}" path="web"${extra.web.attributes}>
<web bind="${web.protocol}://${http.host}:${http.port}" path="web"${extra.web.attributes}>
<app url="jolokia" war="jolokia-war-1.3.5.war"/>
</web>

View File

@ -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