【问题标题】:Spring Config Server Vault Backend: cloud.config.server.vault or cloud.vaultSpring Config Server Vault 后端:cloud.config.server.vault 或 cloud.vault
【发布时间】:2018-12-19 04:13:10
【问题描述】:

我想设置一个能够使用 Vault 和 git 作为配置后端的配置服务器。我不太了解配置:

spring:
  application:
    name: tdev-wssc-configserver

  profiles:
    active: git, vault

  cloud:
    config:
      server:
        git:
          uri: file:///path/to/git/repo
          order: 2
        vault:
          host: ${vault_server_host:localhost}
          port: ${vault_server_port:8200}
          order: 1
    vault:
      enabled: true
      host: ${vault_server_host:localhost}
      port: ${vault_server_port:8200}
      scheme: ${vault_server_scheme:https}
      connection-timeout: 5000
      read-timeout: 15000
      fail-fast: true
      config:
        order: -10
      ssl:
        trust-store: file:keystore.jks
        trust-store-password: secret

我怎么需要设置spring.cloud.config.server.vaultspring.cloud.vault

真的需要两个都设置吗?

它们有什么区别?

我只希望我的客户能够直接从配置服务器获取配置,无论 Vault 是否存在。

所以客户端,只在配置服务器上请求,配置服务器用于从 Vault 获取机密。

【问题讨论】:

    标签: spring spring-cloud-config


    【解决方案1】:

    如果您想将配置服务器与 Git 和 Vault 一起使用 - 使用 Spring Cloud Config 并在属性的 spring.cloud.config.server.vault 部分配置 Vault。见this documentation。在这种情况下你不应该添加 Spring Cloud Vault 的依赖,Spring Cloud Config 已经有 Vault 支持(VaultEnvironmentRepository 类)。

    Spring Cloud Vault 您可以在您不想启动配置服务器并直接从您的服务中从 Vault 获取属性的情况下使用。在这种情况下,使用 Spring Cloud Vault 依赖项并使用 spring.cloud.vault 属性。

    根据您的问题,您似乎希望拥有单独的配置服务器,因此您应该使用 Spring Cloud Config。

    另外这个answer 可能对你有帮助。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-12-22
      • 2017-08-11
      • 2018-01-12
      • 2022-01-08
      • 2017-06-23
      • 2021-09-21
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多