mirror of
https://github.com/plexusorg/Module-HTTPD.git
synced 2024-12-04 17:22:09 +00:00
Add bind address to config
This commit is contained in:
parent
f897ed7488
commit
8e71735d4d
@ -20,7 +20,6 @@ import org.eclipse.jetty.servlet.ServletHandler;
|
|||||||
|
|
||||||
public class HTTPDModule extends PlexModule
|
public class HTTPDModule extends PlexModule
|
||||||
{
|
{
|
||||||
|
|
||||||
public static ServletContextHandler context;
|
public static ServletContextHandler context;
|
||||||
private Thread serverThread;
|
private Thread serverThread;
|
||||||
private AtomicReference<Server> atomicServer = new AtomicReference<>();
|
private AtomicReference<Server> atomicServer = new AtomicReference<>();
|
||||||
@ -28,17 +27,22 @@ public class HTTPDModule extends PlexModule
|
|||||||
@Getter
|
@Getter
|
||||||
private static Permission permissions = null;
|
private static Permission permissions = null;
|
||||||
|
|
||||||
private ModuleConfig config;
|
private ModuleConfig moduleConfig;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void load()
|
||||||
|
{
|
||||||
|
moduleConfig = new ModuleConfig(this, "settings.yml");
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void enable()
|
public void enable()
|
||||||
{
|
{
|
||||||
config = new ModuleConfig(this, "settings.yml");
|
moduleConfig.load();
|
||||||
config.load();
|
PlexLog.debug("HTTPD Module Port: {0}", moduleConfig.getInt("server.port"));
|
||||||
PlexLog.debug("HTTPD Module Port: {0}", config.getInt("server.port"));
|
|
||||||
if (!setupPermissions() && getPlex().getSystem().equalsIgnoreCase("permissions") && !Bukkit.getPluginManager().isPluginEnabled("Vault"))
|
if (!setupPermissions() && getPlex().getSystem().equalsIgnoreCase("permissions") && !Bukkit.getPluginManager().isPluginEnabled("Vault"))
|
||||||
{
|
{
|
||||||
throw new RuntimeException("Plex-HTTPD requires the 'Vault' plugin as well as a Permissions plugin that hooks into 'Vault.' We recommend LuckPerms!");
|
throw new RuntimeException("Plex-HTTPD requires the 'Vault' plugin as well as a Permissions plugin that hooks into 'Vault'. We recommend LuckPerms!");
|
||||||
}
|
}
|
||||||
serverThread = new Thread(() ->
|
serverThread = new Thread(() ->
|
||||||
{
|
{
|
||||||
@ -50,8 +54,8 @@ public class HTTPDModule extends PlexModule
|
|||||||
configuration.addCustomizer(new ForwardedRequestCustomizer());
|
configuration.addCustomizer(new ForwardedRequestCustomizer());
|
||||||
HttpConnectionFactory factory = new HttpConnectionFactory(configuration);
|
HttpConnectionFactory factory = new HttpConnectionFactory(configuration);
|
||||||
ServerConnector connector = new ServerConnector(server, factory);
|
ServerConnector connector = new ServerConnector(server, factory);
|
||||||
connector.setPort(config.getInt("server.port"));
|
connector.setPort(moduleConfig.getInt("server.port"));
|
||||||
connector.setHost("0.0.0.0");
|
connector.setHost(moduleConfig.getString("server.bind-address"));
|
||||||
|
|
||||||
new GetEndpoints();
|
new GetEndpoints();
|
||||||
|
|
||||||
@ -76,7 +80,7 @@ public class HTTPDModule extends PlexModule
|
|||||||
@Override
|
@Override
|
||||||
public void disable()
|
public void disable()
|
||||||
{
|
{
|
||||||
PlexLog.debug("Stopping jetty server");
|
PlexLog.debug("Stopping Jetty server");
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
atomicServer.get().stop();
|
atomicServer.get().stop();
|
||||||
|
@ -1,2 +1,3 @@
|
|||||||
server:
|
server:
|
||||||
|
bind-address: 0.0.0.0
|
||||||
port: 27192
|
port: 27192
|
Loading…
Reference in New Issue
Block a user