【问题标题】:Configure spring cloud config server to use vault as backend配置 spring cloud config server 以使用 vault 作为后端
【发布时间】:2016-12-22 03:50:00
【问题描述】:

文档here 显示,配置服务器可以配置为使用保险库作为其后端,只需在application.properties 中设置以下属性即可

spring.profiles.active=vault

即使这样做了,当嵌入式配置服务器启动时,它仍希望 Git 存储库配置如下:

spring.cloud.config.server.git.uri=repo_url

在没有设置 git repo 属性的情况下失败并出现以下异常。

org.springframework.beans.factory.BeanCreationException: 
Error creating bean with name 
'environmentRepository' defined in class         org.springframework.cloud.config.
server.config.
EnvironmentRepositoryConfiguration$GitRepositoryConfiguration: 
Invocation of init method failed; 
nested exception is java.lang.IllegalStateException: 
You need to configure a uri for the git repository

我不确定如何让配置服务器查找在 localhost:8200 运行的保管库服务器。

【问题讨论】:

  • 它尚未发布,仅在快照中可用。
  • @spencergibb - 感谢您的回复。我尝试使用 maven repo 中可用的快照。您如何建议将 Vault 与 Spring 应用程序集成以存储安全的数据库凭据?
  • 您是否阅读了这篇文章以获得更多背景信息? spring.io/blog/2016/06/24/managing-secrets-with-vault

标签: config spring-cloud spring-cloud-config spring-cloud-vault-config


【解决方案1】:

当使用 vault 作为后端时,您必须在配置服务器 (application.yml) 中添加 vault 服务器信息

spring:
  cloud:
    config:
      server:
        vault:
          port: 8200
          host: 127.0.01

然后在配置客户端(bootstrap.yml)中添加认证令牌

spring:
  cloud:
    config:
      token: myroot

参考: https://cloud.spring.io/spring-cloud-config/single/spring-cloud-config.html#vault-backend https://cloud.spring.io/spring-cloud-config/multi/multi__spring_cloud_config_client.html#_vault

【讨论】:

    猜你喜欢
    • 2017-06-23
    • 1970-01-01
    • 2017-08-11
    • 2018-12-19
    • 2018-01-12
    • 2017-08-23
    • 2017-10-14
    • 2022-01-08
    • 2015-08-25
    相关资源
    最近更新 更多