mirror of
https://gitee.com/mirrors/Spring-Cloud-Alibaba.git
synced 2021-06-26 13:25:11 +08:00
port optimize
This commit is contained in:
parent
a80e9106a6
commit
76cfd2c7fe
@ -68,14 +68,24 @@ public class SidecarConsulAutoRegistration extends ConsulAutoRegistration {
|
|||||||
service.setEnableTagOverride(properties.getEnableTagOverride());
|
service.setEnableTagOverride(properties.getEnableTagOverride());
|
||||||
service.setMeta(getMetadata(properties));
|
service.setMeta(getMetadata(properties));
|
||||||
|
|
||||||
// set health check, use alibaba sidecar self's port rather than polyglot app's
|
if (sidecarProperties.getPort() != null && sidecarProperties.getPort() > 0) {
|
||||||
// port.
|
service.setPort(properties.getPort());
|
||||||
service.setPort(
|
}
|
||||||
Integer.valueOf(context.getEnvironment().getProperty("server.port")));
|
else if (properties.getPort() != null && properties.getPort() > 0) {
|
||||||
setCheck(service, autoServiceRegistrationProperties, properties, context,
|
service.setPort(properties.getPort());
|
||||||
heartbeatProperties);
|
}
|
||||||
|
else if (context.getEnvironment().getProperty("server.port") != null) {
|
||||||
|
// set health check, use alibaba sidecar self's port rather than polyglot
|
||||||
|
// app's port.
|
||||||
|
service.setPort(
|
||||||
|
Integer.valueOf(context.getEnvironment().getProperty("server.port")));
|
||||||
|
}
|
||||||
|
|
||||||
service.setPort(sidecarProperties.getPort());
|
if (service.getPort() != null) {
|
||||||
|
// we know the port and can set the check
|
||||||
|
setCheck(service, autoServiceRegistrationProperties, properties, context,
|
||||||
|
heartbeatProperties);
|
||||||
|
}
|
||||||
|
|
||||||
ConsulAutoRegistration registration = new ConsulAutoRegistration(service,
|
ConsulAutoRegistration registration = new ConsulAutoRegistration(service,
|
||||||
autoServiceRegistrationProperties, properties, context,
|
autoServiceRegistrationProperties, properties, context,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user