Skip to content

Commit

Permalink
Do not exclude properties from recording that are available in source…
Browse files Browse the repository at this point in the history
…s that should always be included

(cherry picked from commit ee36207)
  • Loading branch information
radcortez authored and gsmet committed Oct 11, 2023
1 parent cbd2c6e commit 3bbd07e
Showing 1 changed file with 16 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1018,28 +1018,40 @@ private Converter<?> getConverter(SmallRyeConfig config, Field field, ConverterT
*/
private Set<String> getAllProperties(final Set<String> registeredRoots) {
Set<String> properties = new HashSet<>();

// Get all properties, including the ones generated by interceptors, but these do not include profiles
for (String property : config.getPropertyNames()) {
properties.add(property);
}

Set<String> propertiesToRemove = new HashSet<>();
Set<String> propertiesToAdd = new HashSet<>();

// Get properties per source to collect profiled properties and exclude properties that are build related
for (ConfigSource configSource : config.getConfigSources()) {
if (configSource instanceof SysPropConfigSource || configSource instanceof EnvConfigSource
|| "PropertiesConfigSource[source=Build system]".equals(configSource.getName())) {
for (String property : configSource.getPropertyNames()) {
NameIterator ni = new NameIterator(property);
if (ni.hasNext() && PropertiesUtil.isPropertyInRoot(registeredRoots, ni)) {
properties.add(property);
propertiesToAdd.add(property);
} else {
properties.remove(property);
propertiesToRemove.add(property);
if (configSource instanceof EnvConfigSource) {
properties.remove(StringUtil.toLowerCaseAndDotted(property));
propertiesToRemove.add(StringUtil.toLowerCaseAndDotted(property));
}
}
}
} else {
properties.addAll(configSource.getPropertyNames());
propertiesToAdd.addAll(configSource.getPropertyNames());
}
}

// A property may exist in an excluded source and an include source. We don't have a way to know, so we
// just remove the excluded ones and add the ones to be included, so the property is back there again
properties.removeAll(propertiesToRemove);
properties.addAll(propertiesToAdd);

return properties;
}

Expand Down

0 comments on commit 3bbd07e

Please sign in to comment.