Support configuring SERVER_IP env variable in JVM command #318

This commit is contained in:
Francis Dong
2021-09-26 08:48:21 +08:00
committed by dxfeng10
parent 1fa4caa379
commit 9231040e19

View File

@@ -47,8 +47,12 @@ public class NetworkUtils {
public static String getServerIp() { public static String getServerIp() {
try { try {
if (serverIp == null) { if (serverIp == null) {
serverIp = System.getenv(SERVER_IP); serverIp = System.getProperty(SERVER_IP);
log.info("SERVER_IP is " + serverIp); log.info("JVM env SERVER_IP is " + serverIp);
if (StringUtils.isBlank(serverIp)) {
serverIp = System.getenv(SERVER_IP);
log.info("System env SERVER_IP is " + serverIp);
}
if (StringUtils.isBlank(serverIp)) { if (StringUtils.isBlank(serverIp)) {
boolean found = false; boolean found = false;
Enumeration<NetworkInterface> nis = null; Enumeration<NetworkInterface> nis = null;