mirror of
https://github.com/dbeaver/cloudbeaver.git
synced 2026-09-24 16:04:36 +08:00
CB-2354 update merge configs api
This commit is contained in:
@@ -565,29 +565,31 @@ public class CBApplication extends BaseWebApplication implements WebAuthApplicat
|
||||
throw new DBException("Error parsing server configuration", e);
|
||||
}
|
||||
|
||||
// Backward compatibility: load configs map
|
||||
appConfiguration.loadLegacyCustomConfigs();
|
||||
|
||||
// Merge new config with old one
|
||||
{
|
||||
Map<String, Object> mergedPlugins = Stream.concat(
|
||||
prevConfig.getPlugins().entrySet().stream(),
|
||||
appConfiguration.getPlugins().entrySet().stream()
|
||||
)
|
||||
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (o, o2) -> o2));
|
||||
appConfiguration.setPlugins(mergedPlugins);
|
||||
|
||||
// Backward compatibility: load configs map
|
||||
appConfiguration.loadLegacyCustomConfigs();
|
||||
|
||||
Set<SMAuthProviderCustomConfiguration> mergedAuthProviders = Stream.concat(
|
||||
prevConfig.getAuthCustomConfigurations().stream(),
|
||||
appConfiguration.getAuthCustomConfigurations().stream()
|
||||
)
|
||||
.collect(Collectors.toCollection(LinkedHashSet::new));
|
||||
appConfiguration.setAuthProvidersConfigurations(mergedAuthProviders);
|
||||
}
|
||||
mergeOldConfiguration(prevConfig);
|
||||
|
||||
patchConfigurationWithProperties(productConfiguration);
|
||||
}
|
||||
|
||||
protected void mergeOldConfiguration(CBAppConfig prevConfig) {
|
||||
Map<String, Object> mergedPlugins = Stream.concat(
|
||||
prevConfig.getPlugins().entrySet().stream(),
|
||||
appConfiguration.getPlugins().entrySet().stream()
|
||||
)
|
||||
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (o, o2) -> o2));
|
||||
appConfiguration.setPlugins(mergedPlugins);
|
||||
|
||||
Set<SMAuthProviderCustomConfiguration> mergedAuthProviders = Stream.concat(
|
||||
prevConfig.getAuthCustomConfigurations().stream(),
|
||||
appConfiguration.getAuthCustomConfigurations().stream()
|
||||
)
|
||||
.collect(Collectors.toCollection(LinkedHashSet::new));
|
||||
appConfiguration.setAuthProvidersConfigurations(mergedAuthProviders);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
protected String initHomeFolder() {
|
||||
String homeFolder = System.getenv(CBConstants.ENV_CB_HOME);
|
||||
|
||||
Reference in New Issue
Block a user