将 Spring Cloud Vault Config 配置为从/secret 以外的位置拉取 [英] Configuring Spring Cloud Vault Config to pull from a location other than /secret

查看:42
本文介绍了将 Spring Cloud Vault Config 配置为从/secret 以外的位置拉取的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在将 Spring Cloud Vault Config 集成到 Spring Boot 应用程序中.从主页:

I am currently integrating Spring Cloud Vault Config into a Spring Boot application. From the home page:

Spring Cloud Vault Config 使用应用程序名称和活动配置文件从 Vaults 读取配置属性:

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).我一直在查看参考文档,但我还没有找到具体说明这一点——这可能吗?

I would like to instead provide my own location from which to pull properties from Vault which does not start with /secret (e.g. /deployments/prod). I've been looking through the reference documentation but I haven't found anyway to specify this -- is it possible?

推荐答案

应该这样做.

@Configuration
public class VaultConfiguration {

    @Bean
    public VaultConfigurer configurer() {
        return new VaultConfigurer() {
            @Override
            public void addSecretBackends(SecretBackendConfigurer configurer) {
                configurer.add("secret/my-app/path-1");
                configurer.add("secret/my-app/path-2");

                configurer.registerDefaultGenericSecretBackends(false);
            }
        };
    }
}

这样您就可以扫描放置在自定义路径中的机密

This way you can scan your secrets placed in custom path

问候阿伦

这篇关于将 Spring Cloud Vault Config 配置为从/secret 以外的位置拉取的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆