简体   繁体   English

Spring Cloud领事中的令牌支持

[英]Token support in spring cloud consul

We are using spring-cloud to read the configuration for our application. 我们正在使用spring-cloud来读取应用程序的配置。 We have the similar structure like below in application.yaml 我们在application.yaml中具有类似下面的结构

spring:
  cloud:
    consul:
      host: consul_host
      port: 8500

We want to enable ACL for consul. 我们要为领事启用ACL。 So we need to pass consul token to read the configuration by spring. 因此,我们需要传递consul令牌以在Spring之前读取配置。 How can I specify consul token in application.yaml 如何在application.yaml中指定领事令牌

如果至少使用Spring Cloud Brixton M2(当前版本为RC1),则具有spring.cloud.consul.config.acl-token属性,您可以在其中指定令牌。

The proper answer is to have token placed in following way: 正确的答案是按以下方式放置令牌:

spring:
  cloud:
    consul:
      host: consul_host
      port: 8500
      token: your_token

I'm using Spring Boot version: "2.0.4.RELEASE" + "spring-cloud-starter-consul-config" 我正在使用Spring Boot版本:“ 2.0.4.RELEASE” +“ spring-cloud-starter-consul-config”

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM