Add fail fast flag for config client if local decryption fails

On the server we choose not to fail if a property cannot be decrypted (clients
might be relying on the other values to be able to deal with the failure).

Fixes gh-31
This commit is contained in:
Dave Syer
2014-11-10 09:57:45 +00:00
parent 9d55ef84d0
commit 91e1ddc9a3
5 changed files with 113 additions and 7 deletions

View File

@@ -42,6 +42,17 @@ public class SpringApplicationEnvironmentRepository implements EnvironmentReposi
private String[] locations;
private boolean failOnError = false;
/**
* Strategy to determine how to handle exceptions during decryption.
*
* @param failOnError the flag value (default false)
*/
public void setFailOnError(boolean failOnError) {
this.failOnError = failOnError;
}
@Override
public Environment findOne(String config, String profile, String label) {
SpringApplicationBuilder builder = new SpringApplicationBuilder(
@@ -78,6 +89,7 @@ public class SpringApplicationEnvironmentRepository implements EnvironmentReposi
}
list.add("--spring.config.name=" + config);
list.add("--spring.cloud.bootstrap.enabled=false");
list.add("--encrypt.failOnError=" + failOnError);
if (locations != null) {
list.add("--spring.config.location="
+ StringUtils.arrayToCommaDelimitedString(locations));