Skip to content

sartan/steeltoe-config-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Steeltoe app + Config Server

This repo uses code from Steeltoe Samples to demonstrate deploying your own Config Server to Cloud Foundry and connecting it to your Steeltoe application. Additionally, it documents examples of fetching configuration Config Server.

Deploy your app

cd SimpleCloudFoundry
cf push --hostname <unique-app-hostname>

Deploy our own Config Server

cd configserver
./mvnw package -Dmaven.test.skip=true
cf push config-server -p target/configserver-0.0.1-SNAPSHOT.jar --hostname <unique-config-server-hostname>

Point app at Config Server

http://steeltoe.io/docs/steeltoe-configuration/#2-2-2-configure-settings

Only two settings are really necessary. spring:application:name configures the "application name" to be sample, and spring:cloud:config:uri the address of the config server.

The application name is already configured in the appsettings.json, so we only need to override the config server uri. When translated into environment variables, spring:cloud:config:uri turns into spring__cloud__config__uri. Note the double underscores (__) which denote hierarchy. So to point a Steeltoe application to our own Config Server, we need to set the environment in Cloud Foundry and restart the application.

cf set-env foo spring__cloud__config__uri https://<unique-config-server-hostname>.cfapps.io
cf restart foo

Querying Config Server

Configuration can be queried from Config Server via combination of application, profile, and label.

  • label - in the case of Config Server backed by git, this is a branch, tag, or commit sha
  • application - name of application requesting the configuration
  • profile - a grouping of configuration, which can be used to provide different configuration based on environment such as "dev", "test", "qa", "production"
/{application}/{profile}[/{label}]
/{application}-{profile}.yml
/{application}-{profile}.properties
/{label}/{application}-{profile}.yml
/{label}/{application}-{profile}.properties

Configuration can be accessed in the YAML or properties format, as well as via a JSON payload that returns configuration along with some metadata (i.e. matched application name, property source, etc).

Examples

The examples below use Config Server deployed with a hostname of "my-config-server". Adjust the urls to match your own deployment.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published