From 8c55fe594a6f136ad9c29007eae6eca0c6910f6e Mon Sep 17 00:00:00 2001 From: Dave Syer Date: Thu, 13 Aug 2015 12:40:53 +0000 Subject: [PATCH] Sync docs from master to gh-pages --- spring-cloud-config.html | 111 ++++++++++----------------------------- 1 file changed, 29 insertions(+), 82 deletions(-) diff --git a/spring-cloud-config.html b/spring-cloud-config.html index c4cb9481..e1e0c2c0 100644 --- a/spring-cloud-config.html +++ b/spring-cloud-config.html @@ -451,6 +451,9 @@ body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-b

Spring Cloud Config provides server and client-side support for externalized configuration in a distributed system. With the Config Server you have a central place to manage external properties for applications across all environments. The concepts on both client and server map identically to the Spring Environment and PropertySource abstractions, so they fit very well with Spring applications, but can be used with any application running in any language. As an application moves through the deployment pipeline from dev to test and into production you can manage the configuration between those environments and be certain that applications have everything they need to run when they migrate. The default implementation of the server storage backend uses git so it easily supports labelled versions of configuration environments, as well as being accessible to a wide range of tooling for managing the content. It is easy to add alternative implementations and plug them in with Spring configuration.

+
+

https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/master/docs/src/main/asciidoc/contributing-docs.adoc

+
@@ -660,78 +663,7 @@ the config server URL.

The Server provides an HTTP, resource-based API for external configuration (name-value pairs, or equivalent YAML content). The server is easily embeddable in a Spring Boot application using the -@EnableConfigServer annotation. So this app is a config server:

-
-
-
ConfigServer.java
-
-
@SpringBootApplication
-@EnableConfigServer
-public class ConfigServer {
-  public static void main(String[] args) {
-    SpringApplication.run(ConfigServer.class, args);
-  }
-}
-
-
-
-

Like all Spring Boot apps it runs on port 8080 by default, but you -can switch it to the conventional port 8888 in various ways. The -easiest, which also sets a default configuration repository, -is by launching it with spring.config.name=configserver (there -is a configserver.yml in the Config Server jar). Another is -to use your own application.properties, e.g.

-
-
-
application.properties
-
-
server.port: 8888
-spring.cloud.config.server.git.uri: file://${HOME}/config-repo
-
-
-
-

where ${HOME}/config-repo is a git repository containing -YAML and properties files.

-
-
- - - - - -
-
Tip
-
-
-

Here’s a recipe for creating the git repository in the example -above:

-
-
-
-
$ cd $HOME
-$ mkdir config-repo
-$ cd config-repo
-$ git init .
-$ echo info.foo: bar > application.properties
-$ git add -A .
-$ git commit -m "Add application.properties"
-
-
-
-
-
- - - - - -
-
Warning
-
-using the local filesystem for your git repository is -intended for testing only. Use a server to host your -configuration repositories in production. -
+@EnableConfigServer annotation.

Environment Repository

@@ -836,22 +768,37 @@ repositories:

git: uri: https://github.com/spring-cloud-samples/config-repo repos: - simple: https://github.com/pattern1/config-repo + simple: https://github.com/simple/config-repo special: pattern: pattern*,*pattern1* - uri: https://github.com/pattern2/config-repo + uri: https://github.com/special/config-repo local: pattern: local* uri: file:/home/configsvc/config-repo
-

In the above example, if {application} does not match to any of the +

In the above example, if {application} does not match any of the patterns, it will use the default uri defined under "spring.cloud.config.server.git.uri". For the "simple" repository, the -pattern is "simple" (i.e. it only matches one application). The -pattern format is a comma-separated list of application names with -wildcards.

+pattern is "simple" (i.e. it only matches one application named "simple"). +The pattern format is a comma-separated list of application names with +wildcards (a pattern beginning with a wildcard may need to be quoted).

+
+
+ + + + + +
+
Note
+
+the "one-liner" short cut used in the "simple" example above can +only be used if the only property to be set is the URI. If you need to +set anything else (credentials, pattern, etc.) you need to use the full +form. +

Every repository can also optionally store config files in @@ -1098,9 +1045,9 @@ mysecret

-

Take the encrypted value and add the {cipher} prefix before you put +

Take the encypted value and add the {cipher} prefix before you put it in the YAML or properties file, and before you commit and push it -to a remote, potentially insecure store. The /encrypt and /decrypt +to a remote, potentially insecure store. The /encypt and /decrypt endpoints also both accept paths of the form /*/{name}/{profiles} which can be used to control cryptography per application (name) and profile when clients call into the main Environment resource.

@@ -1133,7 +1080,7 @@ mysecret
-

To use a key in a file (e.g. an RSA public key for encryption) prepend +

To use a key in a file (e.g. an RSA public key for encyption) prepend the key value with "@" and provide the file path, e.g.

@@ -1464,7 +1411,7 @@ grabbing it in the bootstrap context and injecting one).