Skip to main content
 首页 » 编程设计

spring-cloud之将 Spring Cloud Vault Config 配置为从/secret 以外的位置拉取

2024年12月31日12tuyile006

我目前正在整合 Spring Cloud Vault Config进入 Spring Boot 应用程序。从主页:

Spring Cloud Vault Config reads config properties from Vaults using the application name and active profiles:


/secret/{application}/{profile} 
/secret/{application} 
/secret/{default-context}/{profile} 
/secret/{default-context} 

我想提供我自己的位置,从该位置从 Vault 中提取不以/secret 开头的属性(例如/deployments/prod)。我一直在查看引用文档,但我还没有找到具体说明这一点——这可能吗?

请您参考如下方法:

我能够使用 Generic Backend属性将路径按摩到我正在寻找的内容中。就像是:

spring.cloud.vault: 
    generic: 
        enabled: true 
        backend: deployments 
        profile-separator: '/' 
        default-context: prod 
        application-name: my-app 

不幸的是,这也将提取 Vault 位置,例如 deployments/my-appdeployments/prod/activeProfile所以要注意不要在这些地方有任何你不想被捡到的属性(property)。

好像有 desire (and an implementation)允许以编程方式指定这些路径。