Merge remote-tracking branch 'origin/1.4.x'
This commit is contained in:
@@ -912,7 +912,7 @@ TIP: If you want to let the Config Server handle all encryption as well as decry
|
||||
=== Serving Encrypted Properties
|
||||
|
||||
Sometimes you want the clients to decrypt the configuration locally, instead of doing it in the server.
|
||||
In that case, if you provide the `encrypt.*` configuration to locate a key, you can still have `/encrypt` and `/decrypt` endpoints, but you need to explicitly switch off the decryption of outgoing properties by setting `spring.cloud.config.server.encrypt.enabled=false`.
|
||||
In that case, if you provide the `encrypt.*` configuration to locate a key, you can still have `/encrypt` and `/decrypt` endpoints, but you need to explicitly switch off the decryption of outgoing properties by placing `spring.cloud.config.server.encrypt.enabled=false` in `bootstrap.[yml|properties]`.
|
||||
If you do not care about the endpoints, it should work if you do not configure either the key or the enabled flag.
|
||||
|
||||
== Serving Alternative Formats
|
||||
|
||||
@@ -100,6 +100,16 @@ public class JGitEnvironmentRepository extends AbstractScmEnvironmentRepository
|
||||
*/
|
||||
private long lastRefresh;
|
||||
|
||||
/**
|
||||
* Time (in seconds) between refresh of the git repository
|
||||
*/
|
||||
private int refreshRate = 0;
|
||||
|
||||
/**
|
||||
* Time of the last refresh of the git repository
|
||||
*/
|
||||
private long lastRefresh;
|
||||
|
||||
/**
|
||||
* Flag to indicate that the repository should be cloned on startup (not on demand).
|
||||
* Generally leads to slower startup but faster first query.
|
||||
|
||||
@@ -125,6 +125,26 @@ public class MultipleJGitEnvironmentRepositoryIntegrationTests {
|
||||
assertEquals(((MultipleJGitEnvironmentRepository) repository).getRepos().get("test1").getRefreshRate(), 30);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void mappingRepoWithRefreshRate() throws IOException {
|
||||
String defaultRepoUri = ConfigServerTestUtils.prepareLocalRepo("config-repo");
|
||||
String test1RepoUri = ConfigServerTestUtils.prepareLocalRepo("test1-config-repo");
|
||||
|
||||
Map<String, Object> repoMapping = new LinkedHashMap<String, Object>();
|
||||
repoMapping.put("spring.cloud.config.server.git.repos[test1].pattern", "*test1*");
|
||||
repoMapping.put("spring.cloud.config.server.git.repos[test1].uri", test1RepoUri);
|
||||
repoMapping.put("spring.cloud.config.server.git.refreshRate", "30");
|
||||
this.context = new SpringApplicationBuilder(TestConfiguration.class).web(false)
|
||||
.properties("spring.cloud.config.server.git.uri:" + defaultRepoUri)
|
||||
.properties(repoMapping).run();
|
||||
EnvironmentRepository repository = this.context
|
||||
.getBean(EnvironmentRepository.class);
|
||||
repository.findOne("test1-svc", "staging", "master");
|
||||
Environment environment = repository.findOne("test1-svc", "staging", "master");
|
||||
assertEquals(2, environment.getPropertySources().size());
|
||||
assertEquals(((MultipleJGitEnvironmentRepository) repository).getRepos().get("test1").getRefreshRate(), 30);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void mappingRepoWithProfile() throws IOException {
|
||||
String defaultRepoUri = ConfigServerTestUtils.prepareLocalRepo("config-repo");
|
||||
|
||||
Reference in New Issue
Block a user