简体   繁体   English

在启动时仅获取一次密钥保管库机密列表

[英]Get key vault secrets list only once at a startup

What I want to achieve is polling a list of key vault values only once at the start of a microservice.我想要实现的是在微服务启动时仅轮询一次密钥库值列表。 Instead my program polls a list of secrets every 30 mins.相反,我的程序每 30 分钟轮询一次秘密列表。 This is my client configuration:这是我的客户端配置:

public void init() {
secretClient = new SecretClientBuilder()
        .vaultUrl(vaultAddress)
        .credential(new ClientSecretCredentialBuilder()
                .clientId(clientId)
                .tenantId(tenantId)
                .clientSecret(clientSecret)
                .build())
        .buildClient();

} }

1.What refresh-interval should I use in application.yml in order to pull secrets list only once? 1.我应该在application.yml中使用什么刷新间隔才能只拉一次秘密列表?

  1. Is it possible to get secretValue by secretName without polling the whole secrets list?是否可以通过 secretName 获取 secretValue 而无需轮询整个秘密列表?

Responses to the 2 questions:对2个问题的回答:

#1 How does the code snippet relate to the application.yml? #1 代码片段与 application.yml 有什么关系? You can call the SecretClient you create at any interval you like.您可以按您喜欢的任何时间间隔调用您创建的 SecretClient。

#2 Use getSecret(String name) on the SecretClient API #2 在 SecretClient API 上使用 getSecret(String name)

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

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