|
|
@ -22,6 +22,7 @@ import org.apache.commons.lang.StringUtils;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
|
|
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
|
|
|
|
|
|
|
import org.springframework.cloud.commons.util.InetUtils;
|
|
|
|
import org.springframework.core.env.Environment;
|
|
|
|
import org.springframework.core.env.Environment;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -72,6 +73,11 @@ public class PolarisProperties {
|
|
|
|
@Value("${server.port:}")
|
|
|
|
@Value("${server.port:}")
|
|
|
|
private int port;
|
|
|
|
private int port;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* Ip address to be registered.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
private String ipAddress;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 是否开启负载均衡
|
|
|
|
* 是否开启负载均衡
|
|
|
|
*/
|
|
|
|
*/
|
|
|
@ -107,6 +113,12 @@ public class PolarisProperties {
|
|
|
|
@Autowired
|
|
|
|
@Autowired
|
|
|
|
private Environment environment;
|
|
|
|
private Environment environment;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public PolarisProperties(InetUtils inetUtils) {
|
|
|
|
|
|
|
|
if (inetUtils != null) {
|
|
|
|
|
|
|
|
this.ipAddress = inetUtils.findFirstNonLoopbackHostInfo().getIpAddress();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* init properties
|
|
|
|
* init properties
|
|
|
|
*
|
|
|
|
*
|
|
|
@ -218,6 +230,14 @@ public class PolarisProperties {
|
|
|
|
this.port = port;
|
|
|
|
this.port = port;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public String getIpAddress() {
|
|
|
|
|
|
|
|
return ipAddress;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void setIpAddress(String ipAddress) {
|
|
|
|
|
|
|
|
this.ipAddress = ipAddress;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public String getHealthCheckUrl() {
|
|
|
|
public String getHealthCheckUrl() {
|
|
|
|
return healthCheckUrl;
|
|
|
|
return healthCheckUrl;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -237,6 +257,7 @@ public class PolarisProperties {
|
|
|
|
", version='" + version + '\'' +
|
|
|
|
", version='" + version + '\'' +
|
|
|
|
", protocol='" + protocol + '\'' +
|
|
|
|
", protocol='" + protocol + '\'' +
|
|
|
|
", port=" + port +
|
|
|
|
", port=" + port +
|
|
|
|
|
|
|
|
", ipAddress='" + ipAddress + '\'' +
|
|
|
|
", loadbalancerEnabled=" + loadbalancerEnabled +
|
|
|
|
", loadbalancerEnabled=" + loadbalancerEnabled +
|
|
|
|
", policy='" + policy + '\'' +
|
|
|
|
", policy='" + policy + '\'' +
|
|
|
|
", registerEnabled=" + registerEnabled +
|
|
|
|
", registerEnabled=" + registerEnabled +
|
|
|
|