You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by ni...@apache.org on 2019/04/21 08:06:35 UTC

[servicecomb-pack] branch 0.4.x updated: SCB-1264 fix lost consul metadata, such as 'secure=false'

This is an automated email from the ASF dual-hosted git repository.

ningjiang pushed a commit to branch 0.4.x
in repository https://gitbox.apache.org/repos/asf/servicecomb-pack.git


The following commit(s) were added to refs/heads/0.4.x by this push:
     new d7340f7  SCB-1264  fix lost consul metadata, such as 'secure=false'
d7340f7 is described below

commit d7340f7c9a13c73137fce16a96b96ae06fea40ea
Author: ryan xu <fe...@users.noreply.github.com>
AuthorDate: Sun Apr 21 16:06:30 2019 +0800

    SCB-1264  fix lost consul metadata, such as 'secure=false'
    
    fix when server.port=0, health check fail and also fix lose consul metadata, such as 'secure=false' (#454)
---
 .../alpha/server/discovery/consul/AlphaConsulAutoConfiguration.java   | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/alpha/alpha-spring-cloud-starter-consul/src/main/java/org/apache/servicecomb/pack/alpha/server/discovery/consul/AlphaConsulAutoConfiguration.java b/alpha/alpha-spring-cloud-starter-consul/src/main/java/org/apache/servicecomb/pack/alpha/server/discovery/consul/AlphaConsulAutoConfiguration.java
index 53351db..9bfaab4 100644
--- a/alpha/alpha-spring-cloud-starter-consul/src/main/java/org/apache/servicecomb/pack/alpha/server/discovery/consul/AlphaConsulAutoConfiguration.java
+++ b/alpha/alpha-spring-cloud-starter-consul/src/main/java/org/apache/servicecomb/pack/alpha/server/discovery/consul/AlphaConsulAutoConfiguration.java
@@ -114,7 +114,9 @@ public class AlphaConsulAutoConfiguration {
             NewService newservice =  new NewService();
             newservice.setName(service.getServiceName());
             newservice.setId(service.getServiceId());
-            List<String> tags = consulDiscoveryProperties.getTags();
+            newservice.setAddress(service.getAddress());
+            newservice.setPort(service.getServicePort());
+            List<String> tags = service.getServiceTags();
             tags.remove("alpha-server-port=0");
             tags.add("alpha-server-port="+actualAlphaServerPort);
             newservice.setTags(tags);