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:
@@ -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));
|
||||
|
||||
Reference in New Issue
Block a user