Skip to content

Commit c23335d

Browse files
committed
Add 0.0.0.0 support for webserver and make it the default config value
1 parent 62c8306 commit c23335d

File tree

6 files changed

+15
-7
lines changed

6 files changed

+15
-7
lines changed

BlueMapBukkit/src/main/resources/bluemap-bukkit.conf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,9 @@ webserver {
4747
enabled: true
4848

4949
# The IP-Adress that the webserver binds to.
50-
# If this setting is commented out, bluemap tries to find the default ip-adress of your system.
50+
# Use "0.0.0.0" to bind to all available local adresses.
5151
# If you only want to access it locally use "localhost".
52+
# Default is "0.0.0.0"
5253
#ip: "localhost"
5354
#ip: "127.0.0.1"
5455

BlueMapCLI/src/main/resources/bluemap-cli.conf

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,11 @@ webserver {
4444
# With this setting you can enable the integrated web-server.
4545
# Default is disabled
4646
enabled: false
47-
47+
4848
# The IP-Adress that the webserver binds to.
49-
# If this setting is commented out, bluemap tries to find the default ip-adress of your system.
49+
# Use "0.0.0.0" to bind to all available local adresses.
5050
# If you only want to access it locally use "localhost".
51+
# Default is "0.0.0.0"
5152
#ip: "localhost"
5253
#ip: "127.0.0.1"
5354

BlueMapCore/src/main/java/de/bluecolored/bluemap/core/config/MainConfig.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import java.io.File;
2828
import java.io.IOException;
2929
import java.net.InetAddress;
30+
import java.net.InetSocketAddress;
3031
import java.nio.file.Path;
3132
import java.nio.file.Paths;
3233
import java.util.ArrayList;
@@ -109,7 +110,9 @@ private void loadWebConfig(ConfigurationNode node) throws IOException {
109110
if (webserverEnabled) {
110111
//ip
111112
String webserverBindAdressString = node.getNode("ip").getString("");
112-
if (webserverBindAdressString.isEmpty()) {
113+
if (webserverBindAdressString.isEmpty() || webserverBindAdressString.equals("0.0.0.0") || webserverBindAdressString.equals("::0")) {
114+
webserverBindAdress = new InetSocketAddress(0).getAddress(); // 0.0.0.0
115+
} else if (webserverBindAdressString.equals("#getLocalHost")) {
113116
webserverBindAdress = InetAddress.getLocalHost();
114117
} else {
115118
webserverBindAdress = InetAddress.getByName(webserverBindAdressString);

BlueMapFabric/src/main/resources/bluemap-fabric.conf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,9 @@ webserver {
4747
enabled: true
4848

4949
# The IP-Adress that the webserver binds to.
50-
# If this setting is commented out, bluemap tries to find the default ip-adress of your system.
50+
# Use "0.0.0.0" to bind to all available local adresses.
5151
# If you only want to access it locally use "localhost".
52+
# Default is "0.0.0.0"
5253
#ip: "localhost"
5354
#ip: "127.0.0.1"
5455

BlueMapForge/src/main/resources/bluemap-forge.conf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,9 @@ webserver {
4747
enabled: true
4848

4949
# The IP-Adress that the webserver binds to.
50-
# If this setting is commented out, bluemap tries to find the default ip-adress of your system.
50+
# Use "0.0.0.0" to bind to all available local adresses.
5151
# If you only want to access it locally use "localhost".
52+
# Default is "0.0.0.0"
5253
#ip: "localhost"
5354
#ip: "127.0.0.1"
5455

BlueMapSponge/src/main/resources/bluemap-sponge.conf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,9 @@ webserver {
4242
enabled: true
4343

4444
# The IP-Adress that the webserver binds to.
45-
# If this setting is commented out, bluemap tries to find the default ip-adress of your system.
45+
# Use "0.0.0.0" to bind to all available local adresses.
4646
# If you only want to access it locally use "localhost".
47+
# Default is "0.0.0.0"
4748
#ip: "localhost"
4849
#ip: "127.0.0.1"
4950

0 commit comments

Comments
 (0)