(system) To support configurations with multiple docker networks, bind to the "most local" interface.

Make the behavior optional.
This commit is contained in:
Viktor Lofgren 2024-12-19 20:26:31 +01:00
parent e1783891ab
commit b1f970152d

View File

@ -91,14 +91,18 @@ public class ServiceConfigurationModule extends AbstractModule {
return configuredValue;
}
if (Boolean.getBoolean("system.multiFace")) {
try {
return Objects.requireNonNullElse(getLocalNetworkIP(), "0.0.0.0");
}
catch (Exception ex) {
} catch (Exception ex) {
logger.warn("Failed to get local network IP, falling back to bind to 0.0.0.0", ex);
return "0.0.0.0";
}
}
else {
return "0.0.0.0";
}
}
public static String getLocalNetworkIP() throws Exception {
Enumeration<NetworkInterface> nets = NetworkInterface.getNetworkInterfaces();