Skip to content

Commit

Permalink
Bumping versions
Browse files Browse the repository at this point in the history
  • Loading branch information
spring-builds committed Mar 29, 2024
1 parent 470ab67 commit fdb51ef
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,8 @@ void matchIncludeSingleProfile() {
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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,8 @@ void matchIncludeSingleProfile() {
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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,11 +205,13 @@ public static MultipleSourcesContainer processNamedData(List<StrippedSourceConta
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));
Expand All @@ -225,8 +227,8 @@ public static MultipleSourcesContainer processNamedData(List<StrippedSourceConta
}

/*
* 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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ public boolean profileSpecificSources() {
}

/**
* 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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ public boolean profileSpecificSources() {
}

/**
* 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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,14 @@ record WeightedEntry(Map.Entry<String, String> entry, int weight) {
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"
Expand Down

0 comments on commit fdb51ef

Please sign in to comment.