Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace Env Variables Placeholder in spring config server native mode with vault secret #2321

Open
animo93 opened this issue Aug 27, 2023 · 0 comments

Comments

@animo93
Copy link

animo93 commented Aug 27, 2023

I am currently working in a scenario where i need to use spring cloud config server for centralised config management .

Previously we were using the "native" mode to store the configurations in the local filesystem . And the sensitive information like database passwords were stored in the environment variables of the client services .

But , now we want to also use "Hashicorp Vault" to store the database passwords as "secrets" , and simply replace the env variable placeholders in the native files with the secret fetched from vault during the startup .

Current Setup (only "native" mode)
image

Sample content of serviceA-dev.properties

spring.datasource.connectionProperties=jdbc:postgresql://${PG_HOST}:${PG_PORT}/${DB_NAME};username=${DB_USERNAME};password=${DB_PASSWORD}

Expected Setup (both "native" & "vault" mode)
image

Sample content of serviceA-dev.properties

spring.datasource.connectionProperties=jdbc:postgresql://${PG_HOST}:${PG_PORT}/${DB_NAME};username=${DB_USERNAME};password=${DB_PASSWORD}

But here instead of storing the values of ${DB_PASSWORD} in env variables , we want to connect to vault during the startup , and then replace this with the actual value fetched from the vault

So , can this be achieved ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants