Skip to content

Commit

Permalink
fix: handling already existing optional config groups (#267)
Browse files Browse the repository at this point in the history
Co-authored-by: Tarek Chouaki <[email protected]>
Co-authored-by: Sebastian Hörl <[email protected]>
  • Loading branch information
3 people authored Oct 3, 2024
1 parent 9d3a934 commit 6abc3a3
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,9 @@ protected void registerOptionalConfigGroup(ConfigGroup configGroup, Collection<A

public void addOptionalConfigGroups(Config config) {
for (ConfigGroup configGroup : optionalConfigGroups.values()) {
if (config.getModules().get(configGroup.getName()) != null) {
ConfigGroup existingConfigGroup = config.getModules().get(configGroup.getName());
// if a config group with the same name exist and is still a generic ConfigGroup instance, we replace it by the optional config group instance
if (existingConfigGroup != null && existingConfigGroup.getClass().equals(ConfigGroup.class)) {
config.addModule(configGroup);
}
}
Expand Down

0 comments on commit 6abc3a3

Please sign in to comment.