When my application which uses Spring Cloud Vault starter is requesting info from Vault, it searches the followed paths at generic secret back-end:
So as you can see, it does a lot of requests to a Vault and that's a problem because Vault will create a lot of unnecessary logs which is bad for a few reasons.
How can I change paths for the requests?
For instance, I want my application to go to secret/myapp/{profile} and that's all.
There are two approaches you can take:
spring.cloud.vault.generic.default-context
to an empty value.Spring Vault creates path matrices based on the application name multiplied with the profiles you activated and based on a generic name multiplied with active profiles.
Providing a VaultConfigurer
bean inside the bootstrap context gives you the most control over paths accessed by Spring Cloud Vault:
public class MyVaultConfigurer implements VaultConfigurer {
@Override
public void addSecretBackends(SecretBackendConfigurer configurer) {
configurer.add("secret/my-application");
configurer.registerDefaultGenericSecretBackends(false);
configurer.registerDefaultDiscoveredSecretBackends(true);
}
}