static
This commit is contained in:
parent
7b60e2ef3f
commit
5b711c676a
@ -38,9 +38,12 @@ public interface Constants {
|
|||||||
*/
|
*/
|
||||||
String PREFER_HOSTNAME_OVER_IP_PROPERTY_NAME = "nacos.preferHostnameOverIp";
|
String PREFER_HOSTNAME_OVER_IP_PROPERTY_NAME = "nacos.preferHostnameOverIp";
|
||||||
|
|
||||||
|
String NACOS_SERVER_IP = "nacos.server.ip";
|
||||||
|
|
||||||
String USE_ONLY_SITE_INTERFACES = "nacos.inetutils.use-only-site-local-interfaces";
|
String USE_ONLY_SITE_INTERFACES = "nacos.inetutils.use-only-site-local-interfaces";
|
||||||
String PREFERRED_NETWORKS = "nacos.inetutils.preferred-networks";
|
String PREFERRED_NETWORKS = "nacos.inetutils.preferred-networks";
|
||||||
String IGNORED_INTERFACES = "nacos.inetutils.ignored-interfaces";
|
String IGNORED_INTERFACES = "nacos.inetutils.ignored-interfaces";
|
||||||
String IP_ADDRESS = "nacos.inetutils.ip-address";
|
String IP_ADDRESS = "nacos.inetutils.ip-address";
|
||||||
String PREFER_HOSTNAME_OVER_IP = "nacos.inetutils.prefer-hostname-over-ip";
|
String PREFER_HOSTNAME_OVER_IP = "nacos.inetutils.prefer-hostname-over-ip";
|
||||||
|
String SYSTEM_PREFER_HOSTNAME_OVER_IP = "nacos.preferHostnameOverIp";
|
||||||
}
|
}
|
||||||
|
@ -63,7 +63,7 @@ public class InetUtils {
|
|||||||
ignoredInterfaces.add(ignored);
|
ignoredInterfaces.add(ignored);
|
||||||
}
|
}
|
||||||
|
|
||||||
String nacosIp = System.getProperty("nacos.server.ip");
|
String nacosIp = System.getProperty(NACOS_SERVER_IP);
|
||||||
if (StringUtils.isBlank(nacosIp)) {
|
if (StringUtils.isBlank(nacosIp)) {
|
||||||
nacosIp = PropertyUtil.getProperty(IP_ADDRESS);
|
nacosIp = PropertyUtil.getProperty(IP_ADDRESS);
|
||||||
}
|
}
|
||||||
@ -75,7 +75,7 @@ public class InetUtils {
|
|||||||
selfIp = nacosIp;
|
selfIp = nacosIp;
|
||||||
|
|
||||||
if (StringUtils.isBlank(selfIp)) {
|
if (StringUtils.isBlank(selfIp)) {
|
||||||
preferHostnameOverIp = Boolean.getBoolean("nacos.preferHostnameOverIp");
|
preferHostnameOverIp = Boolean.getBoolean(SYSTEM_PREFER_HOSTNAME_OVER_IP);
|
||||||
|
|
||||||
if (!preferHostnameOverIp) {
|
if (!preferHostnameOverIp) {
|
||||||
preferHostnameOverIp = Boolean.parseBoolean(PREFER_HOSTNAME_OVER_IP);
|
preferHostnameOverIp = Boolean.parseBoolean(PREFER_HOSTNAME_OVER_IP);
|
||||||
|
Loading…
Reference in New Issue
Block a user