简体   繁体   中英

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. 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. Is it possible to get secretValue by secretName without polling the whole secrets list?

Responses to the 2 questions:

#1 How does the code snippet relate to the application.yml? You can call the SecretClient you create at any interval you like.

#2 Use getSecret(String name) on the SecretClient API

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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