From c4e71d8eea011a08bd9886afb5eea52ce3261d8a Mon Sep 17 00:00:00 2001 From: Dave Syer Date: Sat, 14 Jun 2014 14:34:02 +0100 Subject: [PATCH] Update docs and add uri parameter --- README.md | 26 +++++++++++++++++++ .../platform/config/server/Application.java | 2 ++ 2 files changed, 28 insertions(+) diff --git a/README.md b/README.md index fb36efbe..1ad23937 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,32 @@ $ cd spring-platform-config-server $ mvn spring-boot:run ``` +Then try it: + +``` +$ curl localhost:8888/foo/development +{"name":"development","label":"master","propertySources":[ + {"name":"https://github.com/scratches/config-repo/foo-development.properties","source":{"bar":"spam"}}, + {"name":"https://github.com/scratches/config-repo/foo.properties","source":{"foo":"bar"}} +]} +``` + +The default strategy for locating property sources is to clone a GIT +repository (at "spring.platform.config.uri") and use it to initialize +a `SpringApplication`. The application's `Environment` is used to +enumerate property sources. The service has resources in the form: + +``` +/{name}/{profile}[/{label}] +``` + +where the "name" is used as the config name in the `SpringApplication` +(i.e. what is normally "application"), "profile" is an active profile +(or comma-separated list of properties), and "label" is an optional +git label (defaults to "master"). + +### Client Side Usage + Build a client (e.g. see the test cases for the config-client) as a Spring Boot application that depends on spring-platform-config-client. When it runs it will pick up the external configuration from the diff --git a/spring-platform-config-server/src/main/java/org/springframework/platform/config/server/Application.java b/spring-platform-config-server/src/main/java/org/springframework/platform/config/server/Application.java index 8f926b55..464e5809 100644 --- a/spring-platform-config-server/src/main/java/org/springframework/platform/config/server/Application.java +++ b/spring-platform-config-server/src/main/java/org/springframework/platform/config/server/Application.java @@ -4,6 +4,7 @@ package org.springframework.platform.config.server; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; +import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; @@ -53,6 +54,7 @@ public class Application { @Profile("!native") protected static class GitRepositoryConfiguration { @Bean + @ConfigurationProperties("spring.platform.config") public JGitEnvironmentRepository repository() { return new JGitEnvironmentRepository(); }