In my Spring application I have multiple postgresql databases, number of DBs is not static and can be different between different environments. In order to manage credentials for them I want to use Hashicorp Vault and its database engine to create users on the fly with a short TTL.
It is easy to read from KV using VaultTemplate (from spring-cloud-starter-vault-config), but it does not support databases.
I also found that it is supported as configuration on startup using https://cloud.spring.io/spring-cloud-vault/reference/html/#vault.config.backends.postgresql, but I need to have those credentials dynamic.
So - is it possible to read from database engine entries in a same way as for KV?
Found a quick solution, but happy to see a better ones...
have a pojo class:
And then read it like so: