Sync docs from master to gh-pages
This commit is contained in:
@@ -246,7 +246,7 @@ To use it in production, you need to be sure that the file system is reliable an
|
||||
In this way, you can segregate the directories in the path and choose a strategy that makes sense for you (such as subdirectory per application or subdirectory per profile).</p><p>If you do not use placeholders in the search locations, this repository also appends the <code class="literal">{label}</code> parameter of the HTTP resource to a suffix on the search path, so properties files are loaded from each search location <span class="strong"><strong>and</strong></span> a subdirectory with the same name as the label (the labelled properties take precedence in the Spring Environment).
|
||||
Thus, the default behaviour with no placeholders is the same as adding a search location ending with <code class="literal">/{label}/</code>.
|
||||
For example, <code class="literal">file:/tmp/config</code> is the same as <code class="literal">file:/tmp/config,file:/tmp/config/{label}</code>.
|
||||
This behavior can be disabled by setting <code class="literal">spring.cloud.config.server.native.addLabelLocations=false</code>.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="_vault_backend" href="#_vault_backend"></a>2.1.11 Vault Backend</h3></div></div></div><p>Spring Cloud Config Server also supports <a class="link" href="https://www.vaultproject.io" target="_top">Vault</a> as a backend.</p><div class="sidebar"><div class="titlepage"></div><p>Vault is a tool for securely accessing secrets.
|
||||
This behavior can be disabled by setting <code class="literal">spring.cloud.config.server.native.addLabelLocations=false</code>.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="vault-backend" href="#vault-backend"></a>2.1.11 Vault Backend</h3></div></div></div><p>Spring Cloud Config Server also supports <a class="link" href="https://www.vaultproject.io" target="_top">Vault</a> as a backend.</p><div class="sidebar"><div class="titlepage"></div><p>Vault is a tool for securely accessing secrets.
|
||||
A secret is anything that to which you want to tightly control access, such as API keys, passwords, certificates, and other sensitive information. Vault provides a unified interface to any secret while providing tight access control and recording a detailed audit log.</p></div><p>For more information on Vault, see the <a class="link" href="https://www.vaultproject.io/intro/index.html" target="_top">Vault quick start guide</a>.</p><p>To enable the config server to use a Vault backend, you can run your config server with the <code class="literal">vault</code> profile.
|
||||
For example, in your config server’s <code class="literal">application.properties</code>, you can add <code class="literal">spring.profiles.active=vault</code>.</p><p>By default, the config server assumes that your Vault server runs at <code class="literal"><a class="link" href="http://127.0.0.1:8200" target="_top">http://127.0.0.1:8200</a></code>.
|
||||
It also assumes that the name of backend is <code class="literal">secret</code> and the key is <code class="literal">application</code>.
|
||||
@@ -283,15 +283,29 @@ secret/myApp
|
||||
secret/application,dev
|
||||
secret/application</pre><p>Properties written to <code class="literal">secret/application</code> are available to <a class="link" href="">all applications using the Config Server</a>.
|
||||
An application with the name, <code class="literal">myApp</code>, would have any properties written to <code class="literal">secret/myApp</code> and <code class="literal">secret/application</code> available to it.
|
||||
When <code class="literal">myApp</code> has the <code class="literal">dev</code> profile enabled, properties written to all of the above paths would be available to it, with properties in the first path in the list taking priority over the others.</p></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="_sharing_configuration_with_all_applications" href="#_sharing_configuration_with_all_applications"></a>2.1.12 Sharing Configuration With All Applications</h3></div></div></div><p>Sharing configuration between all applications varies according to which approach you take, as described in the following topics:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><a class="xref" href="multi__spring_cloud_config_server.html#spring-cloud-config-server-file-based-repositories" title="File Based Repositories">the section called “File Based Repositories”</a></li><li class="listitem"><a class="xref" href="multi__spring_cloud_config_server.html#spring-cloud-config-server-vault-server" title="Vault Server">the section called “Vault Server”</a></li></ul></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a name="spring-cloud-config-server-file-based-repositories" href="#spring-cloud-config-server-file-based-repositories"></a>File Based Repositories</h4></div></div></div><p>With file-based (git, svn, and native) repositories, resources with file names in <code class="literal">application*</code> (<code class="literal">application.properties</code>, <code class="literal">application.yml</code>, <code class="literal">application-*.properties</code>, and so on) are shared between all client applications.
|
||||
When <code class="literal">myApp</code> has the <code class="literal">dev</code> profile enabled, properties written to all of the above paths would be available to it, with properties in the first path in the list taking priority over the others.</p></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="_accessing_backends_through_a_proxy" href="#_accessing_backends_through_a_proxy"></a>2.1.12 Accessing Backends Through a Proxy</h3></div></div></div><p>The configuration server can access a Git or Vault backend through an HTTP or HTTPS proxy. This behavior is controlled for either Git or Vault by settings under <code class="literal">proxy.http</code> and <code class="literal">proxy.https</code>. These settings are per repository, so if you are using a <a class="link" href="multi__spring_cloud_config_server.html#composite-environment-repositories" title="2.1.15 Composite Environment Repositories">composite environment repository</a> you must configure proxy settings for each backend in the composite individually. If using a network which requires separate proxy servers for HTTP and HTTPS URLs, you can configure both the HTTP and the HTTPS proxy settings for a single backend.</p><p>The following table describes the proxy configuration properties for both HTTP and HTTPS proxies. All of these properties must be prefixed by <code class="literal">proxy.http</code> or <code class="literal">proxy.https</code>.</p><div class="table"><a name="d0e1024" href="#d0e1024"></a><p class="title"><b>Table 2.2. Proxy Configuration Properties</b></p><div class="table-contents"><table summary="Proxy Configuration Properties" style="border-collapse: collapse;border-top: 0.5pt solid ; border-bottom: 0.5pt solid ; border-left: 0.5pt solid ; border-right: 0.5pt solid ; "><colgroup><col class="col_1"><col class="col_2"></colgroup><thead><tr><th style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top">Property Name</th><th style="border-bottom: 0.5pt solid ; " align="left" valign="top">Remarks</th></tr></thead><tbody><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><span class="strong"><strong>host</strong></span></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>The host of the proxy.</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><span class="strong"><strong>port</strong></span></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>The port with which to access the proxy.</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><span class="strong"><strong>nonProxyHosts</strong></span></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>Any hosts which the configuration server should access outside the proxy. If values are provided for both <code class="literal">proxy.http.nonProxyHosts</code> and <code class="literal">proxy.https.nonProxyHosts</code>, the <code class="literal">proxy.http</code> value will be used.</p></td></tr><tr><td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; " align="left" valign="top"><p><span class="strong"><strong>username</strong></span></p></td><td style="border-bottom: 0.5pt solid ; " align="left" valign="top"><p>The username with which to authenticate to the proxy. If values are provided for both <code class="literal">proxy.http.username</code> and <code class="literal">proxy.https.username</code>, the <code class="literal">proxy.http</code> value will be used.</p></td></tr><tr><td style="border-right: 0.5pt solid ; " align="left" valign="top"><p><span class="strong"><strong>password</strong></span></p></td><td style="" align="left" valign="top"><p>The password with which to authenticate to the proxy. If values are provided for both <code class="literal">proxy.http.password</code> and <code class="literal">proxy.https.password</code>, the <code class="literal">proxy.http</code> value will be used.</p></td></tr></tbody></table></div></div><br class="table-break"><p>The following configuration uses an HTTPS proxy to access a Git repository.</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring</span>:
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> profiles</span>:
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> active</span>: git
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> cloud</span>:
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> config</span>:
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> server</span>:
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> git</span>:
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> uri</span>: https://github.com/spring-cloud-samples/config-repo
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> proxy</span>:
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> https</span>:
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> host</span>: my-proxy.host.io
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> password</span>: myproxypassword
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> port</span>: <span xmlns:d="http://docbook.org/ns/docbook" class="hl-string">'3128'</span>
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> username</span>: myproxyusername
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> nonProxyHosts</span>: example.com</pre></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="_sharing_configuration_with_all_applications" href="#_sharing_configuration_with_all_applications"></a>2.1.13 Sharing Configuration With All Applications</h3></div></div></div><p>Sharing configuration between all applications varies according to which approach you take, as described in the following topics:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><a class="xref" href="multi__spring_cloud_config_server.html#spring-cloud-config-server-file-based-repositories" title="File Based Repositories">the section called “File Based Repositories”</a></li><li class="listitem"><a class="xref" href="multi__spring_cloud_config_server.html#spring-cloud-config-server-vault-server" title="Vault Server">the section called “Vault Server”</a></li></ul></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a name="spring-cloud-config-server-file-based-repositories" href="#spring-cloud-config-server-file-based-repositories"></a>File Based Repositories</h4></div></div></div><p>With file-based (git, svn, and native) repositories, resources with file names in <code class="literal">application*</code> (<code class="literal">application.properties</code>, <code class="literal">application.yml</code>, <code class="literal">application-*.properties</code>, and so on) are shared between all client applications.
|
||||
You can use resources with these file names to configure global defaults and have them be overridden by application-specific files as necessary.</p><p>The #_property_overrides[property overrides] feature can also be used for setting global defaults, with placeholders applications
|
||||
allowed to override them locally.</p><div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Tip"><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="images/tip.png"></td><th align="left">Tip</th></tr><tr><td align="left" valign="top"><p>With the “native” profile (a local file system backend) , you should use an explicit search location that is not part of the server’s own configuration.
|
||||
Otherwise, the <code class="literal">application*</code> resources in the default search locations get removed because they are part of the server.</p></td></tr></table></div></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a name="spring-cloud-config-server-vault-server" href="#spring-cloud-config-server-vault-server"></a>Vault Server</h4></div></div></div><p>When using Vault as a backend, you can share configuration with all applications by placing configuration in <code class="literal">secret/application</code>.
|
||||
For example, if you run the following Vault command, all applications using the config server will have the properties <code class="literal">foo</code> and <code class="literal">baz</code> available to them:</p><pre class="programlisting">$ vault write secret/application foo=bar baz=bam</pre></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="_jdbc_backend" href="#_jdbc_backend"></a>2.1.13 JDBC Backend</h3></div></div></div><p>Spring Cloud Config Server supports JDBC (relational database) as a backend for configuration properties.
|
||||
For example, if you run the following Vault command, all applications using the config server will have the properties <code class="literal">foo</code> and <code class="literal">baz</code> available to them:</p><pre class="programlisting">$ vault write secret/application foo=bar baz=bam</pre></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="_jdbc_backend" href="#_jdbc_backend"></a>2.1.14 JDBC Backend</h3></div></div></div><p>Spring Cloud Config Server supports JDBC (relational database) as a backend for configuration properties.
|
||||
You can enable this feature by adding <code class="literal">spring-jdbc</code> to the classpath and using the <code class="literal">jdbc</code> profile or by adding a bean of type <code class="literal">JdbcEnvironmentRepository</code>.
|
||||
If you include the right dependencies on the classpath (see the user guide for more details on that), Spring Boot configures a data source.</p><p>The database needs to have a table called <code class="literal">PROPERTIES</code> with columns called <code class="literal">APPLICATION</code>, <code class="literal">PROFILE</code>, and <code class="literal">LABEL</code> (with the usual <code class="literal">Environment</code> meaning), plus <code class="literal">KEY</code> and <code class="literal">VALUE</code> for the key and value pairs in <code class="literal">Properties</code> style.
|
||||
All fields are of type String in Java, so you can make them <code class="literal">VARCHAR</code> of whatever length you need.
|
||||
Property values behave in the same way as they would if they came from Spring Boot properties files named <code class="literal">{application}-{profile}.properties</code>, including all the encryption and decryption, which will be applied as post-processing steps (that is, not in the repository implementation directly).</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="_composite_environment_repositories" href="#_composite_environment_repositories"></a>2.1.14 Composite Environment Repositories</h3></div></div></div><p>In some scenarios, you may wish to pull configuration data from multiple environment repositories.
|
||||
Property values behave in the same way as they would if they came from Spring Boot properties files named <code class="literal">{application}-{profile}.properties</code>, including all the encryption and decryption, which will be applied as post-processing steps (that is, not in the repository implementation directly).</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="composite-environment-repositories" href="#composite-environment-repositories"></a>2.1.15 Composite Environment Repositories</h3></div></div></div><p>In some scenarios, you may wish to pull configuration data from multiple environment repositories.
|
||||
To do so, you can enable the <code class="literal">composite</code> profile in your configuration server’s application properties or YAML file.
|
||||
If, for example, you want to pull configuration data from a Subversion repository as well as two Git repositories, you can set the following properties for your configuration server:</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring</span>:
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> profiles</span>:
|
||||
@@ -311,25 +325,26 @@ If, for example, you want to pull configuration data from a Subversion repositor
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> uri</span>: file:///path/to/walter/git/repo</pre><p>Using this configuration, precedence is determined by the order in which repositories are listed under the <code class="literal">composite</code> key.
|
||||
In the above example, the Subversion repository is listed first, so a value found in the Subversion repository will override values found for the same property in one of the Git repositories.
|
||||
A value found in the <code class="literal">rex</code> Git repository will be used before a value found for the same property in the <code class="literal">walter</code> Git repository.</p><p>If you want to pull configuration data only from repositories that are each of distinct types, you can enable the corresponding profiles, rather than the <code class="literal">composite</code> profile, in your configuration server’s application properties or YAML file.
|
||||
If, for example, you want to pull configuration data from a single Git repository and a single Subversion repository, you can set the following properties for your configuration server:</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring</span>:
|
||||
If, for example, you want to pull configuration data from a single Git repository and a single HashiCorp Vault server, you can set the following properties for your configuration server:</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring</span>:
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> profiles</span>:
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> active</span>: git<span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">,</span> subversion
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> active</span>: git<span xmlns:d="http://docbook.org/ns/docbook" class="hl-keyword">,</span> vault
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> cloud</span>:
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> config</span>:
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> server</span>:
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> git</span>:
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> uri</span>: file:///path/to/git/repo
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> order</span>: <span class="hl-number">2</span>
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> svn</span>:
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> uri</span>: file:///path/to/svn/repo
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> vault</span>:
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> host</span>: <span class="hl-number">127.0</span>.<span class="hl-number">0.1</span>
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> port</span>: <span class="hl-number">8200</span>
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> order</span>: <span class="hl-number">1</span></pre><p>Using this configuration, precedence can be determined by an <code class="literal">order</code> property.
|
||||
You can use the <code class="literal">order</code> property to specify the priority order for all your repositories.
|
||||
The lower the numerical value of the <code class="literal">order</code> property, the higher priority it has.
|
||||
The priority order of a repository helps resolve any potential conflicts between repositories that contain values for the same properties.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Note"><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="images/note.png"></td><th align="left">Note</th></tr><tr><td align="left" valign="top"><p>Any type of failure when retrieving values from an environment repository results in a failure for the entire composite environment.</p></td></tr></table></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Note"><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="images/note.png"></td><th align="left">Note</th></tr><tr><td align="left" valign="top"><p>When using a composite environment, it is important that all repositories contain the same labels.
|
||||
The priority order of a repository helps resolve any potential conflicts between repositories that contain values for the same properties.</p><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Note"><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="images/note.png"></td><th align="left">Note</th></tr><tr><td align="left" valign="top"><p>If your composite environment includes a Vault server as in the previous example, you must include a Vault token in every request made to the configuration server. See <a class="link" href="multi__spring_cloud_config_server.html#vault-backend" title="2.1.11 Vault Backend">Vault Backend</a>.</p></td></tr></table></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Note"><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="images/note.png"></td><th align="left">Note</th></tr><tr><td align="left" valign="top"><p>Any type of failure when retrieving values from an environment repository results in a failure for the entire composite environment.</p></td></tr></table></div><div class="note" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Note"><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="images/note.png"></td><th align="left">Note</th></tr><tr><td align="left" valign="top"><p>When using a composite environment, it is important that all repositories contain the same labels.
|
||||
If you have an environment similar to those in the preceding examples and you request configuration data with the <code class="literal">master</code> label but the Subversion repository does not contain a branch called <code class="literal">master</code>, the entire request fails.</p></td></tr></table></div><div class="section"><div class="titlepage"><div><div><h4 class="title"><a name="_custom_composite_environment_repositories" href="#_custom_composite_environment_repositories"></a>Custom Composite Environment Repositories</h4></div></div></div><p>In addition to using one of the environment repositories from Spring Cloud, you can also provide your own <code class="literal">EnvironmentRepository</code> bean to be included as part of a composite environment.
|
||||
To do so, your bean must implement the <code class="literal">EnvironmentRepository</code> interface.
|
||||
If you want to control the priority of your custom <code class="literal">EnvironmentRepository</code> within the composite environment, you should also implement the <code class="literal">Ordered</code> interface and override the <code class="literal">getOrdered</code> method.
|
||||
If you do not implement the <code class="literal">Ordered</code> interface, your <code class="literal">EnvironmentRepository</code> is given the lowest priority.</p></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="_property_overrides" href="#_property_overrides"></a>2.1.15 Property Overrides</h3></div></div></div><p>The Config Server has an “overrides” feature that lets the operator provide configuration properties to all applications.
|
||||
If you do not implement the <code class="literal">Ordered</code> interface, your <code class="literal">EnvironmentRepository</code> is given the lowest priority.</p></div></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a name="_property_overrides" href="#_property_overrides"></a>2.1.16 Property Overrides</h3></div></div></div><p>The Config Server has an “overrides” feature that lets the operator provide configuration properties to all applications.
|
||||
The overridden properties cannot be accidentally changed by the application with the normal Spring Boot hooks.
|
||||
To declare overrides, add a map of name-value pairs to <code class="literal">spring.cloud.config.server.overrides</code>, as shown in the following example:</p><pre class="programlisting"><span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute">spring</span>:
|
||||
<span xmlns:d="http://docbook.org/ns/docbook" class="hl-attribute"> cloud</span>:
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -571,7 +571,7 @@ Thus, the default behaviour with no placeholders is the same as adding a search
|
||||
For example, <literal>file:/tmp/config</literal> is the same as <literal>file:/tmp/config,file:/tmp/config/{label}</literal>.
|
||||
This behavior can be disabled by setting <literal>spring.cloud.config.server.native.addLabelLocations=false</literal>.</simpara>
|
||||
</section>
|
||||
<section xml:id="_vault_backend">
|
||||
<section xml:id="vault-backend">
|
||||
<title>Vault Backend</title>
|
||||
<simpara>Spring Cloud Config Server also supports <link xl:href="https://www.vaultproject.io">Vault</link> as a backend.</simpara>
|
||||
<sidebar>
|
||||
@@ -678,6 +678,62 @@ An application with the name, <literal>myApp</literal>, would have any propertie
|
||||
When <literal>myApp</literal> has the <literal>dev</literal> profile enabled, properties written to all of the above paths would be available to it, with properties in the first path in the list taking priority over the others.</simpara>
|
||||
</section>
|
||||
</section>
|
||||
<section xml:id="_accessing_backends_through_a_proxy">
|
||||
<title>Accessing Backends Through a Proxy</title>
|
||||
<simpara>The configuration server can access a Git or Vault backend through an HTTP or HTTPS proxy. This behavior is controlled for either Git or Vault by settings under <literal>proxy.http</literal> and <literal>proxy.https</literal>. These settings are per repository, so if you are using a <link linkend="composite-environment-repositories">composite environment repository</link> you must configure proxy settings for each backend in the composite individually. If using a network which requires separate proxy servers for HTTP and HTTPS URLs, you can configure both the HTTP and the HTTPS proxy settings for a single backend.</simpara>
|
||||
<simpara>The following table describes the proxy configuration properties for both HTTP and HTTPS proxies. All of these properties must be prefixed by <literal>proxy.http</literal> or <literal>proxy.https</literal>.</simpara>
|
||||
<table frame="all" rowsep="1" colsep="1">
|
||||
<title>Proxy Configuration Properties</title>
|
||||
<tgroup cols="2">
|
||||
<colspec colname="col_1" colwidth="50*"/>
|
||||
<colspec colname="col_2" colwidth="50*"/>
|
||||
<thead>
|
||||
<row>
|
||||
<entry align="left" valign="top">Property Name</entry>
|
||||
<entry align="left" valign="top">Remarks</entry>
|
||||
</row>
|
||||
</thead>
|
||||
<tbody>
|
||||
<row>
|
||||
<entry align="left" valign="top"><simpara><emphasis role="strong">host</emphasis></simpara></entry>
|
||||
<entry align="left" valign="top"><simpara>The host of the proxy.</simpara></entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry align="left" valign="top"><simpara><emphasis role="strong">port</emphasis></simpara></entry>
|
||||
<entry align="left" valign="top"><simpara>The port with which to access the proxy.</simpara></entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry align="left" valign="top"><simpara><emphasis role="strong">nonProxyHosts</emphasis></simpara></entry>
|
||||
<entry align="left" valign="top"><simpara>Any hosts which the configuration server should access outside the proxy. If values are provided for both <literal>proxy.http.nonProxyHosts</literal> and <literal>proxy.https.nonProxyHosts</literal>, the <literal>proxy.http</literal> value will be used.</simpara></entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry align="left" valign="top"><simpara><emphasis role="strong">username</emphasis></simpara></entry>
|
||||
<entry align="left" valign="top"><simpara>The username with which to authenticate to the proxy. If values are provided for both <literal>proxy.http.username</literal> and <literal>proxy.https.username</literal>, the <literal>proxy.http</literal> value will be used.</simpara></entry>
|
||||
</row>
|
||||
<row>
|
||||
<entry align="left" valign="top"><simpara><emphasis role="strong">password</emphasis></simpara></entry>
|
||||
<entry align="left" valign="top"><simpara>The password with which to authenticate to the proxy. If values are provided for both <literal>proxy.http.password</literal> and <literal>proxy.https.password</literal>, the <literal>proxy.http</literal> value will be used.</simpara></entry>
|
||||
</row>
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</table>
|
||||
<simpara>The following configuration uses an HTTPS proxy to access a Git repository.</simpara>
|
||||
<programlisting language="yaml" linenumbering="unnumbered">spring:
|
||||
profiles:
|
||||
active: git
|
||||
cloud:
|
||||
config:
|
||||
server:
|
||||
git:
|
||||
uri: https://github.com/spring-cloud-samples/config-repo
|
||||
proxy:
|
||||
https:
|
||||
host: my-proxy.host.io
|
||||
password: myproxypassword
|
||||
port: '3128'
|
||||
username: myproxyusername
|
||||
nonProxyHosts: example.com</programlisting>
|
||||
</section>
|
||||
<section xml:id="_sharing_configuration_with_all_applications">
|
||||
<title>Sharing Configuration With All Applications</title>
|
||||
<simpara>Sharing configuration between all applications varies according to which approach you take, as described in the following topics:</simpara>
|
||||
@@ -716,7 +772,7 @@ If you include the right dependencies on the classpath (see the user guide for m
|
||||
All fields are of type String in Java, so you can make them <literal>VARCHAR</literal> of whatever length you need.
|
||||
Property values behave in the same way as they would if they came from Spring Boot properties files named <literal>{application}-{profile}.properties</literal>, including all the encryption and decryption, which will be applied as post-processing steps (that is, not in the repository implementation directly).</simpara>
|
||||
</section>
|
||||
<section xml:id="_composite_environment_repositories">
|
||||
<section xml:id="composite-environment-repositories">
|
||||
<title>Composite Environment Repositories</title>
|
||||
<simpara>In some scenarios, you may wish to pull configuration data from multiple environment repositories.
|
||||
To do so, you can enable the <literal>composite</literal> profile in your configuration server’s application properties or YAML file.
|
||||
@@ -741,24 +797,28 @@ If, for example, you want to pull configuration data from a Subversion repositor
|
||||
In the above example, the Subversion repository is listed first, so a value found in the Subversion repository will override values found for the same property in one of the Git repositories.
|
||||
A value found in the <literal>rex</literal> Git repository will be used before a value found for the same property in the <literal>walter</literal> Git repository.</simpara>
|
||||
<simpara>If you want to pull configuration data only from repositories that are each of distinct types, you can enable the corresponding profiles, rather than the <literal>composite</literal> profile, in your configuration server’s application properties or YAML file.
|
||||
If, for example, you want to pull configuration data from a single Git repository and a single Subversion repository, you can set the following properties for your configuration server:</simpara>
|
||||
If, for example, you want to pull configuration data from a single Git repository and a single HashiCorp Vault server, you can set the following properties for your configuration server:</simpara>
|
||||
<programlisting language="yaml" linenumbering="unnumbered">spring:
|
||||
profiles:
|
||||
active: git, subversion
|
||||
active: git, vault
|
||||
cloud:
|
||||
config:
|
||||
server:
|
||||
git:
|
||||
uri: file:///path/to/git/repo
|
||||
order: 2
|
||||
svn:
|
||||
uri: file:///path/to/svn/repo
|
||||
vault:
|
||||
host: 127.0.0.1
|
||||
port: 8200
|
||||
order: 1</programlisting>
|
||||
<simpara>Using this configuration, precedence can be determined by an <literal>order</literal> property.
|
||||
You can use the <literal>order</literal> property to specify the priority order for all your repositories.
|
||||
The lower the numerical value of the <literal>order</literal> property, the higher priority it has.
|
||||
The priority order of a repository helps resolve any potential conflicts between repositories that contain values for the same properties.</simpara>
|
||||
<note>
|
||||
<simpara>If your composite environment includes a Vault server as in the previous example, you must include a Vault token in every request made to the configuration server. See <link linkend="vault-backend">Vault Backend</link>.</simpara>
|
||||
</note>
|
||||
<note>
|
||||
<simpara>Any type of failure when retrieving values from an environment repository results in a failure for the entire composite environment.</simpara>
|
||||
</note>
|
||||
<note>
|
||||
|
||||
Reference in New Issue
Block a user