Skip to content

steve-perkins/spring-config-sample-app

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

spring-config-sample-app

This is one of three Git repositories, which work together to demonstrate using Spring Cloud Config and Vault for configuration management:

This demo shows the use case of having two types of config properties:

  1. non-secret values, which can and should be maintainable by developer teams (e.g. JDBC URL's).
  2. secret values, which should only be viewable or maintainable by people with specialized access (e.g. usernames and passwords)

The non-secret values are stored as-is in the spring-config-properties repo. The secret values are manually written to Vault. At runtime, Spring Cloud Config retrieves properties from both sources, giving Vault the higher precedence whenever the same property is found in both.

Setup

  • Perform the steps described in the spring-config-server project README.
  • This repo is a Gradle-based project, containing a Spring Boot-based web app. The Gradle script includes a bootRun task for conveniently launching the Spring Boot app. When calling this task, you'll need to pass JVM system properties needed by the client to reach Vault:
gradlew bootRun -DVAULT_URL=http://127.0.0.1:8200 -DVAULT_USERNAME=vault_user -DVAULT_PASSWORD=vault_pass
  • You can access the web application in your browser at: http://localhost:8080.

  • Make some changes to your properties, either in Git or in Vault.

  • Force the sample app to retrieve the latest properties on-the-fly without a restart, by hitting the /refresh endpoint with an empty POST request:

curl -X POST http://localhost:8080/refresh
  • Refresh the root page in your browser to verify that your update was received.

About

Spring Cloud Config demo with a Git and Vault composite repository

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published