Bumping versions
This commit is contained in:
@@ -168,7 +168,8 @@ class NamedConfigMapContextToSourceDataProviderTests {
|
||||
ConfigUtils.Prefix.DEFAULT, true, true);
|
||||
MockEnvironment environment = new MockEnvironment();
|
||||
environment.setActiveProfiles("with-profile");
|
||||
KubernetesClientConfigContext context = new KubernetesClientConfigContext(api, source, NAMESPACE, environment, false);
|
||||
KubernetesClientConfigContext context = new KubernetesClientConfigContext(api, source, NAMESPACE, environment,
|
||||
false);
|
||||
|
||||
KubernetesClientContextToSourceData data = new NamedConfigMapContextToSourceDataProvider().get();
|
||||
SourceData sourceData = data.apply(context);
|
||||
|
||||
@@ -221,7 +221,8 @@ class NamedSecretContextToSourceDataProviderTests {
|
||||
true, true);
|
||||
MockEnvironment environment = new MockEnvironment();
|
||||
environment.addActiveProfile("with-profile");
|
||||
KubernetesClientConfigContext context = new KubernetesClientConfigContext(api, source, NAMESPACE, environment, false);
|
||||
KubernetesClientConfigContext context = new KubernetesClientConfigContext(api, source, NAMESPACE, environment,
|
||||
false);
|
||||
|
||||
KubernetesClientContextToSourceData data = new NamedSecretContextToSourceDataProvider().get();
|
||||
SourceData sourceData = data.apply(context);
|
||||
|
||||
@@ -205,11 +205,13 @@ public final class ConfigUtils {
|
||||
rawData = decodeData(rawData);
|
||||
}
|
||||
|
||||
// In some cases we want to include properties from the default profile along with any active profiles
|
||||
// In some cases we want to include properties from the default profile
|
||||
// along with any active profiles
|
||||
// In these cases includeDefaultProfileData will be true
|
||||
// If includeDefaultProfileData is false then we want to make sure that we only return properties from any active profiles
|
||||
// If includeDefaultProfileData is false then we want to make sure that we
|
||||
// only return properties from any active profiles
|
||||
|
||||
//Check the source to see if it contains any active profiles
|
||||
// Check the source to see if it contains any active profiles
|
||||
boolean containsActiveProfile = environment.getActiveProfiles().length == 0
|
||||
|| Arrays.stream(environment.getActiveProfiles())
|
||||
.anyMatch(p -> source.contains("-" + p) || "default".equals(p));
|
||||
@@ -225,8 +227,8 @@ public final class ConfigUtils {
|
||||
}
|
||||
|
||||
/*
|
||||
* In the case there the data contains yaml or properties files we need to check their names to see if they
|
||||
* contain any active profiles.
|
||||
* In the case there the data contains yaml or properties files we need to check their
|
||||
* names to see if they contain any active profiles.
|
||||
*/
|
||||
private static boolean containsDataWithProfile(Map<String, String> rawData, String[] activeProfiles) {
|
||||
return rawData.keySet().stream().anyMatch(
|
||||
|
||||
@@ -59,8 +59,8 @@ public final class NamedConfigMapNormalizedSource extends NormalizedSource {
|
||||
}
|
||||
|
||||
/**
|
||||
* append or not the active profiles to the name of the generated source.
|
||||
* At the moment this is true only for config server generated sources.
|
||||
* append or not the active profiles to the name of the generated source. At the
|
||||
* moment this is true only for config server generated sources.
|
||||
*/
|
||||
public boolean appendProfileToName() {
|
||||
return appendProfileToName;
|
||||
|
||||
@@ -54,8 +54,8 @@ public final class NamedSecretNormalizedSource extends NormalizedSource {
|
||||
}
|
||||
|
||||
/**
|
||||
* append or not the active profiles to the name of the generated source.
|
||||
* At the moment this is true only for config server generated sources.
|
||||
* append or not the active profiles to the name of the generated source. At the
|
||||
* moment this is true only for config server generated sources.
|
||||
*/
|
||||
public boolean appendProfileToName() {
|
||||
return appendProfileToName;
|
||||
|
||||
@@ -104,10 +104,14 @@ public class SourceDataEntriesProcessor extends MapPropertySource {
|
||||
String applicationName = ConfigUtils.getApplicationName(environment, "", "");
|
||||
String[] activeProfiles = environment.getActiveProfiles();
|
||||
|
||||
// In some cases we want to include the properties from the default profile along with any properties from any active profiles
|
||||
// In this case includeDefaultProfileData will be true or the active profile will be default
|
||||
// In the case where includeDefaultProfileData is false we only want to include the properties from the active profiles
|
||||
boolean includeDataEntry = includeDefaultProfileData || Arrays.asList(environment.getActiveProfiles()).contains("default");
|
||||
// In some cases we want to include the properties from the default profile along
|
||||
// with any properties from any active profiles
|
||||
// In this case includeDefaultProfileData will be true or the active profile will
|
||||
// be default
|
||||
// In the case where includeDefaultProfileData is false we only want to include
|
||||
// the properties from the active profiles
|
||||
boolean includeDataEntry = includeDefaultProfileData
|
||||
|| Arrays.asList(environment.getActiveProfiles()).contains("default");
|
||||
|
||||
// the order here is important, first has to come "application.yaml" and then
|
||||
// "application-dev.yaml"
|
||||
|
||||
Reference in New Issue
Block a user