I need to externalize the Vault token and backend to use in my SpringBoot/Cloud application so that the same binary can be deployed to different Pivotal Cloud Foundry spaces. For example I have a single .jar
I want to push
to Dev
, Test
, QA
, PROD
spaces without have to rebuild the .jar
.
I also have a ConfigServer
backed by a git
repo as well as a User Provided Service
, that could hold the information but that just moves the externalization problem, it does not solve it. And it causes more problems, specifically with the order that objects are created in.
I am struggling to get the relevant information like the vault token
and vault backend
to use externalized settings from the .jar
.
All the examples I can find use the bootstrap.properties
or application.yml
spring:
cloud:
config:
token: YourVaultToken
and that obviously will not work because it is embedded in the .jar
and would be environment specific.
Solutions that use the default Spring magic bindings will not work because I need to manually make calls using VaultTemplate
.
What is the most idiomatic way to externalize the client configuration of how to connect to the Vault and read the secrets with
VaultTemplate
where I do not have to rebuild the.jar
for each environment.