Skip to content

Commit 83c2845

Browse files
author
Andreas Huber
committed
Fix missing ACL token for getAllInstances
Requests made by ConsulDiscoveryCLient.getAllInstances() were missing the ACL token. Fixes gh-847
1 parent 0260422 commit 83c2845

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

spring-cloud-consul-discovery/src/main/java/org/springframework/cloud/consul/discovery/ConsulDiscoveryClient.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,11 @@ private void addInstancesToList(List<ServiceInstance> instances, String serviceI
8686
public List<ServiceInstance> getAllInstances() {
8787
List<ServiceInstance> instances = new ArrayList<>();
8888

89-
Response<Map<String, List<String>>> services = this.client
90-
.getCatalogServices(CatalogServicesRequest.newBuilder().setQueryParams(QueryParams.DEFAULT).build());
89+
CatalogServicesRequest request = CatalogServicesRequest.newBuilder()
90+
.setQueryParams(QueryParams.DEFAULT)
91+
.setToken(this.properties.getAclToken())
92+
.build();
93+
Response<Map<String, List<String>>> services = this.client.getCatalogServices(request);
9194
for (String serviceId : services.getValue().keySet()) {
9295
addInstancesToList(instances, serviceId, QueryParams.DEFAULT);
9396
}

0 commit comments

Comments
 (0)