Allow environment overrides to be escaped for placeholders
E.g. spring.cloud.config.server.overrides.foo=$\{bar} will evaluate
to foo=${bar} in the client's Environment (allowing local replacement
of the placeholder instead of on the configserver).
This commit is contained in:
@@ -234,4 +234,15 @@ public class EnvironmentControllerTests {
|
||||
.get(0).getSource().toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void overrideWithEscapedPlaceholders() throws Exception {
|
||||
controller.setOverrides(Collections.singletonMap("foo", "$\\{bar}"));
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
map.put("bar", "foo");
|
||||
environment.add(new PropertySource("one", map));
|
||||
Mockito.when(repository.findOne("foo", "bar", "master")).thenReturn(environment);
|
||||
assertEquals("{foo=${bar}}", controller.defaultLabel("foo", "bar").getPropertySources()
|
||||
.get(0).getSource().toString());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user