diff --git a/server/bundles/io.cloudbeaver.model/src/io/cloudbeaver/utils/WebAppUtils.java b/server/bundles/io.cloudbeaver.model/src/io/cloudbeaver/utils/WebAppUtils.java index 3041b83f1e..f0be02942b 100644 --- a/server/bundles/io.cloudbeaver.model/src/io/cloudbeaver/utils/WebAppUtils.java +++ b/server/bundles/io.cloudbeaver.model/src/io/cloudbeaver/utils/WebAppUtils.java @@ -74,13 +74,16 @@ public static SMAuthenticationManager getAuthManager(WebApplication application) } @SuppressWarnings("unchecked") - public static Map mergeConfigurations(Map origin, Map additional) { + public static Map mergeConfigurations( + Map priorityConfiguration, + Map additional + ) { var resultConfig = new HashMap(); - Set rootKeys = new HashSet<>(origin.keySet()); + Set rootKeys = new HashSet<>(priorityConfiguration.keySet()); rootKeys.addAll(additional.keySet()); for (var rootKey : rootKeys) { - var originValue = origin.get(rootKey); + var originValue = priorityConfiguration.get(rootKey); var additionalValue = additional.get(rootKey); if (originValue == null || additionalValue == null) { diff --git a/server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/server/CBServerConfigurationController.java b/server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/server/CBServerConfigurationController.java index 52f04f51fd..02f1214531 100644 --- a/server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/server/CBServerConfigurationController.java +++ b/server/bundles/io.cloudbeaver.server/src/io/cloudbeaver/server/CBServerConfigurationController.java @@ -283,8 +283,13 @@ protected Map readConfiguration(Path configPath) throws DBExcept Map configProps = new LinkedHashMap<>(); if (Files.exists(configPath)) { log.debug("Read configuration [" + configPath.toAbsolutePath() + "]"); + + configProps.putAll(readConfigurationFile(configPath)); + + var mergedOriginalConfigs = WebAppUtils.mergeConfigurations(configProps, originalConfigurationProperties); + this.originalConfigurationProperties.clear(); // saves original configuration file - this.originalConfigurationProperties.putAll(readConfigurationFile(configPath)); + this.originalConfigurationProperties.putAll(mergedOriginalConfigs); configProps.putAll(readConfigurationFile(configPath)); patchConfigurationWithProperties(configProps); // patch original properties