Merge remote-tracking branch 'origin/2.1.x'
This commit is contained in:
@@ -1143,7 +1143,7 @@ TIP: If you testing with curl, then use `--data-urlencode` (instead of `-d`) or
|
||||
|
||||
Take the encrypted 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` endpoints also both accept paths in the form of `/*/{name}/{profiles}`, which can be used to control cryptography on a per-application (name) and per-profile basis when clients call into the main environment resource.
|
||||
The `/encrypt` and `/decrypt` endpoints also both accept paths in the form of `/*/{application}/{profiles}`, which can be used to control cryptography on a per-application (name) and per-profile basis when clients call into the main environment resource.
|
||||
|
||||
NOTE: To control the cryptography in this granular way, you must also provide a `@Bean` of type `TextEncryptorLocator` that creates a different encryptor per name and profiles.
|
||||
The one that is provided by default does not do so (all encryptions use the same key).
|
||||
@@ -1273,7 +1273,7 @@ Also, the YAML representation is not necessarily a faithful representation of th
|
||||
== Serving Plain Text
|
||||
|
||||
Instead of using the `Environment` abstraction (or one of the alternative representations of it in YAML or properties format), your applications might need generic plain-text configuration files that are tailored to their environment.
|
||||
The Config Server provides these through an additional endpoint at `/{name}/{profile}/{label}/{path}`, where `name`, `profile`, and `label` have the same meaning as the regular environment endpoint, but `path` is a file name (such as `log.xml`).
|
||||
The Config Server provides these through an additional endpoint at `/{application}/{profile}/{label}/{path}`, where `application`, `profile`, and `label` have the same meaning as the regular environment endpoint, but `path` is a path to a file name (such as `log.xml`).
|
||||
The source files for this endpoint are located in the same way as for the environment endpoints.
|
||||
The same search path is used for properties and YAML files.
|
||||
However, instead of aggregating all matching resources, only the first one to match is returned.
|
||||
@@ -1394,8 +1394,8 @@ However, by default, it looks for changes in files that match the application na
|
||||
The strategy to use when you want to override the behavior is `PropertyPathNotificationExtractor`, which accepts the request headers and body as parameters and returns a list of file paths that changed.
|
||||
|
||||
The default configuration works out of the box with Github, Gitlab, Gitea, Gitee, Gogs or Bitbucket.
|
||||
In addition to the JSON notifications from Github, Gitlab, Gitee, or Bitbucket, you can trigger a change notification by POSTing to `/monitor` with form-encoded body parameters in the pattern of `path={name}`.
|
||||
Doing so broadcasts to applications matching the `{name}` pattern (which can contain wildcards).
|
||||
In addition to the JSON notifications from Github, Gitlab, Gitee, or Bitbucket, you can trigger a change notification by POSTing to `/monitor` with form-encoded body parameters in the pattern of `path={application}`.
|
||||
Doing so broadcasts to applications matching the `{application}` pattern (which can contain wildcards).
|
||||
|
||||
NOTE: The `RefreshRemoteApplicationEvent` is transmitted only if the `spring-cloud-bus` is activated in both the Config Server and in the client application.
|
||||
|
||||
@@ -1466,7 +1466,7 @@ Spring Retry has a `RetryInterceptorBuilder` that supports creating one.
|
||||
|
||||
=== Locating Remote Configuration Resources
|
||||
|
||||
The Config Service serves property sources from `/{name}/{profile}/{label}`, where the default bindings in the client app are as follows:
|
||||
The Config Service serves property sources from `/{application}/{profile}/{label}`, where the default bindings in the client app are as follows:
|
||||
|
||||
* "name" = `${spring.application.name}`
|
||||
* "profile" = `${spring.profiles.active}` (actually `Environment.getActiveProfiles()`)
|
||||
|
||||
@@ -105,6 +105,20 @@ public class HttpClientConfigurableHttpConnectionFactory
|
||||
return HttpClients.custom();
|
||||
}
|
||||
if (builderMap.size() > 1) {
|
||||
/*
|
||||
* Try to determine if there is an exact match URL or not. So if there is a
|
||||
* placeholder in the URL, filter it out. We should be left with only URLs
|
||||
* which have no placeholders. That is the one we want to use in the case
|
||||
* there are multiple matches.
|
||||
*/
|
||||
List<String> keys = builderMap.keySet().stream().filter(key -> {
|
||||
String[] tokens = key.split(PLACEHOLDER_PATTERN);
|
||||
return tokens.length == 1;
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
if (keys.size() == 1) {
|
||||
return builderMap.get(keys.get(0));
|
||||
}
|
||||
this.log.error(String.format(
|
||||
"More than one git repo URL template matched URL:"
|
||||
+ " %s, proxy and skipSslValidation config won't be applied. Matched templates: %s",
|
||||
|
||||
@@ -159,6 +159,24 @@ public class HttpClientConfigurableHttpConnectionFactoryTest {
|
||||
assertThat(actualHttpClientBuilder).isSameAs(expectedHttpClientBuilder);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void multipleMatchesWithPlaceholder() throws Exception {
|
||||
MultipleJGitEnvironmentProperties properties1 = new MultipleJGitEnvironmentProperties();
|
||||
properties1.setUri("https://github.com/marnee01/mderider-{application}.git");
|
||||
MultipleJGitEnvironmentProperties properties2 = new MultipleJGitEnvironmentProperties();
|
||||
properties2.setUri("https://github.com/marnee01/mderider-MultiApps.git");
|
||||
this.connectionFactory.addConfiguration(properties1);
|
||||
this.connectionFactory.addConfiguration(properties2);
|
||||
|
||||
HttpConnection actualConnection = this.connectionFactory.create(new URL(
|
||||
"https://github.com/marnee01/mderider-MultiApps.git/info/refs?service=git-upload-pack"));
|
||||
HttpClientBuilder expectedHttpClientBuilder = this.connectionFactory.httpClientBuildersByUri
|
||||
.get(properties2.getUri());
|
||||
HttpClientBuilder actualHttpClientBuilder = getActualHttpClientBuilder(
|
||||
actualConnection);
|
||||
assertThat(actualHttpClientBuilder).isSameAs(expectedHttpClientBuilder);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void composite_urlsWithPlaceholders() throws Exception {
|
||||
MultipleJGitEnvironmentProperties properties1 = new MultipleJGitEnvironmentProperties();
|
||||
|
||||
Reference in New Issue
Block a user