Add 0.0.0.0 support for webserver and make it the default config value

This commit is contained in:
Blue (Lukas Rieger) 2020-08-08 10:39:22 +02:00
parent 62c8306b8c
commit c23335df7c
6 changed files with 15 additions and 7 deletions

View File

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

View File

@ -44,10 +44,11 @@ webserver {
# With this setting you can enable the integrated web-server.
# Default is disabled
enabled: false
# The IP-Adress that the webserver binds to.
# If this setting is commented out, bluemap tries to find the default ip-adress of your system.
# Use "0.0.0.0" to bind to all available local adresses.
# If you only want to access it locally use "localhost".
# Default is "0.0.0.0"
#ip: "localhost"
#ip: "127.0.0.1"

View File

@ -27,6 +27,7 @@ package de.bluecolored.bluemap.core.config;
import java.io.File;
import java.io.IOException;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
@ -109,7 +110,9 @@ public class MainConfig implements WebServerConfig {
if (webserverEnabled) {
//ip
String webserverBindAdressString = node.getNode("ip").getString("");
if (webserverBindAdressString.isEmpty()) {
if (webserverBindAdressString.isEmpty() || webserverBindAdressString.equals("0.0.0.0") || webserverBindAdressString.equals("::0")) {
webserverBindAdress = new InetSocketAddress(0).getAddress(); // 0.0.0.0
} else if (webserverBindAdressString.equals("#getLocalHost")) {
webserverBindAdress = InetAddress.getLocalHost();
} else {
webserverBindAdress = InetAddress.getByName(webserverBindAdressString);

View File

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

View File

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

View File

@ -42,8 +42,9 @@ webserver {
enabled: true
# The IP-Adress that the webserver binds to.
# If this setting is commented out, bluemap tries to find the default ip-adress of your system.
# Use "0.0.0.0" to bind to all available local adresses.
# If you only want to access it locally use "localhost".
# Default is "0.0.0.0"
#ip: "localhost"
#ip: "127.0.0.1"