77import org .springframework .context .annotation .Bean ;
88import org .springframework .context .annotation .Configuration ;
99
10+ import java .net .InetAddress ;
11+
1012import net .discordjug .javabot .data .config .SystemsConfig ;
1113
1214
1820public class TomcatConfig {
1921
2022 private final int ajpPort ;
23+ private final InetAddress ajpAddress ;
2124 private final boolean tomcatAjpEnabled ;
2225 private final SystemsConfig systemsConfig ;
2326
@@ -26,11 +29,13 @@ public class TomcatConfig {
2629 * @param ajpPort The port to run AJP under
2730 * @param tomcatAjpEnabled <code>true</code> if AJP is enabled, else <code>false</code>
2831 * @param systemsConfig an object representing the configuration of various systems
32+ * @param ajpAddress the listen address for AJP
2933 */
30- public TomcatConfig (@ Value ("${tomcat.ajp.port}" ) int ajpPort , @ Value ("${tomcat.ajp.enabled}" ) boolean tomcatAjpEnabled , SystemsConfig systemsConfig ) {
34+ public TomcatConfig (@ Value ("${tomcat.ajp.port}" ) int ajpPort , @ Value ("${tomcat.ajp.enabled}" ) boolean tomcatAjpEnabled , @ Value ( "${tomcat.ajp.address}" ) InetAddress ajpAddress , SystemsConfig systemsConfig ) {
3135 this .ajpPort = ajpPort ;
3236 this .tomcatAjpEnabled = tomcatAjpEnabled ;
3337 this .systemsConfig = systemsConfig ;
38+ this .ajpAddress = ajpAddress ;
3439 }
3540
3641 /**
@@ -46,6 +51,7 @@ TomcatServletWebServerFactory servletContainer() {
4651 Connector ajpConnector = new Connector ("org.apache.coyote.ajp.AjpNioProtocol" );
4752 AjpNioProtocol protocol = (AjpNioProtocol ) ajpConnector .getProtocolHandler ();
4853 protocol .setSecret (systemsConfig .getApiConfig ().getAjpSecret ());
54+ protocol .setAddress (ajpAddress );
4955 ajpConnector .setPort (ajpPort );
5056 ajpConnector .setSecure (true );
5157 tomcat .addAdditionalTomcatConnectors (ajpConnector );
0 commit comments