Add config for hostname.
This commit is contained in:
@@ -23,6 +23,7 @@ package io.kamax.mxisd;
|
|||||||
import io.kamax.mxisd.config.MatrixConfig;
|
import io.kamax.mxisd.config.MatrixConfig;
|
||||||
import io.kamax.mxisd.config.MxisdConfig;
|
import io.kamax.mxisd.config.MxisdConfig;
|
||||||
import io.kamax.mxisd.config.PolicyConfig;
|
import io.kamax.mxisd.config.PolicyConfig;
|
||||||
|
import io.kamax.mxisd.config.ServerConfig;
|
||||||
import io.kamax.mxisd.http.undertow.handler.ApiHandler;
|
import io.kamax.mxisd.http.undertow.handler.ApiHandler;
|
||||||
import io.kamax.mxisd.http.undertow.handler.AuthorizationHandler;
|
import io.kamax.mxisd.http.undertow.handler.AuthorizationHandler;
|
||||||
import io.kamax.mxisd.http.undertow.handler.CheckTermsHandler;
|
import io.kamax.mxisd.http.undertow.handler.CheckTermsHandler;
|
||||||
@@ -145,7 +146,8 @@ public class HttpMxisd {
|
|||||||
termsEndpoints(handler);
|
termsEndpoints(handler);
|
||||||
hashEndpoints(handler);
|
hashEndpoints(handler);
|
||||||
accountEndpoints(handler);
|
accountEndpoints(handler);
|
||||||
httpSrv = Undertow.builder().addHttpListener(m.getConfig().getServer().getPort(), "0.0.0.0").setHandler(handler).build();
|
ServerConfig serverConfig = m.getConfig().getServer();
|
||||||
|
httpSrv = Undertow.builder().addHttpListener(serverConfig.getPort(), serverConfig.getHostname()).setHandler(handler).build();
|
||||||
|
|
||||||
httpSrv.start();
|
httpSrv.start();
|
||||||
}
|
}
|
||||||
|
@@ -34,6 +34,7 @@ public class ServerConfig {
|
|||||||
private String name;
|
private String name;
|
||||||
private int port = 8090;
|
private int port = 8090;
|
||||||
private String publicUrl;
|
private String publicUrl;
|
||||||
|
private String hostname;
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return name;
|
return name;
|
||||||
@@ -59,6 +60,14 @@ public class ServerConfig {
|
|||||||
this.publicUrl = publicUrl;
|
this.publicUrl = publicUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getHostname() {
|
||||||
|
return hostname;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHostname(String hostname) {
|
||||||
|
this.hostname = hostname;
|
||||||
|
}
|
||||||
|
|
||||||
public void build() {
|
public void build() {
|
||||||
log.info("--- Server config ---");
|
log.info("--- Server config ---");
|
||||||
|
|
||||||
@@ -75,8 +84,13 @@ public class ServerConfig {
|
|||||||
log.warn("Public URL is not valid: {}", StringUtils.defaultIfBlank(e.getMessage(), "<no reason provided>"));
|
log.warn("Public URL is not valid: {}", StringUtils.defaultIfBlank(e.getMessage(), "<no reason provided>"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (StringUtils.isBlank(getHostname())) {
|
||||||
|
setHostname("0.0.0.0");
|
||||||
|
}
|
||||||
|
|
||||||
log.info("Name: {}", getName());
|
log.info("Name: {}", getName());
|
||||||
log.info("Port: {}", getPort());
|
log.info("Port: {}", getPort());
|
||||||
log.info("Public URL: {}", getPublicUrl());
|
log.info("Public URL: {}", getPublicUrl());
|
||||||
|
log.info("Hostname: {}", getHostname());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user