Compare commits

...
4 Commits
Author SHA1 Message Date
serge-rider 32b967b18f Merge branch 'release_24_1_0' of https://github.com/dbeaver/cloudbeaver into release_24_1_0 2024-06-21 09:36:37 +02:00
Aleksandr Skoblikov df97d90756 CB-5289 load logs config in log service 2024-06-21 09:36:29 +02:00
Aleksei Potsetsuev f19e93749e CB-5276 fix: auth fallback 2024-06-14 22:31:30 +08:00
Alexander Skoblikov 96621eadd3 Hotfix/cb 5253 (#2694)
* CB-5253 store only changed common runtime properties

* CB-5253 remove null properties
2024-06-07 10:57:47 +00:00
4 changed files with 40 additions and 12 deletions
@@ -105,16 +105,7 @@ public abstract class BaseWebApplication extends BaseApplicationImpl implements
protected boolean loadServerConfiguration() throws DBException {
Path configFilePath = getMainConfigurationFilePath().toAbsolutePath();
Path configFolder = configFilePath.getParent();
// Configure logging
Path logbackConfigPath = getLogbackConfigPath(configFolder);
if (logbackConfigPath == null) {
System.err.println("Can't find slf4j configuration file in " + configFilePath.getParent());
} else {
System.setProperty("logback.configurationFile", logbackConfigPath.toString());
}
Log.setLogHandler(new SLF4JLogHandler());
// Load config file
@@ -210,7 +201,9 @@ public abstract class BaseWebApplication extends BaseApplicationImpl implements
}
@SuppressWarnings("unchecked")
public static void patchConfigurationWithProperties(Map<String, Object> configProps, IVariableResolver varResolver) {
public static void patchConfigurationWithProperties(
Map<String, Object> configProps, IVariableResolver varResolver
) {
for (Map.Entry<String, Object> entry : configProps.entrySet()) {
Object propValue = entry.getValue();
if (propValue instanceof String) {
@@ -87,7 +87,12 @@ public class WebAppUtils {
var additionalValue = additional.get(rootKey);
if (originValue == null || additionalValue == null) {
var resultValue = originValue != null ? originValue : additionalValue;
Object resultValue = null;
if (additional.containsKey(rootKey)) {
resultValue = additionalValue;
} else if (originValue != null) {
resultValue = originValue;
}
resultConfig.put(rootKey, resultValue);
continue;
}
@@ -133,6 +138,10 @@ public class WebAppUtils {
if (!(oldValue instanceof String)) {
return newValue;
}
//new value already contains variable pattern
if (newValue instanceof String newStringValue && GeneralUtils.isVariablePattern(newStringValue)) {
return newValue;
}
String value = (String) oldValue;
if (!GeneralUtils.isVariablePattern(value)) {
return newValue;
@@ -17,8 +17,34 @@
package io.cloudbeaver.slf4j;
import ch.qos.logback.classic.spi.LogbackServiceProvider;
import org.slf4j.helpers.Reporter;
import java.nio.file.Files;
import java.nio.file.Path;
public class CloudBeaverLogServiceProvider extends LogbackServiceProvider {
private static final String LOGBACK_CONF_FILE_PROPERTY = "logback.configurationFile";
private static final String MAIN_LOGBACK_CONFIG = "conf/logback.xml";
private static final String CUSTOM_LOGBACK_CONFIG = "conf/custom/logback.xml";
public CloudBeaverLogServiceProvider() {
if (System.getProperty(LOGBACK_CONF_FILE_PROPERTY) != null) {
return;
}
String logbackConfig = null;
if (Files.exists(Path.of(CUSTOM_LOGBACK_CONFIG))) {
logbackConfig = CUSTOM_LOGBACK_CONFIG;
} else if (Files.exists(Path.of(MAIN_LOGBACK_CONFIG))) {
logbackConfig = MAIN_LOGBACK_CONFIG;
}
if (logbackConfig != null) {
System.setProperty(LOGBACK_CONF_FILE_PROPERTY, Path.of(logbackConfig).toString());
Reporter.info("Logback configuration is used: " + logbackConfig);
} else {
Reporter.info("No logback configuration found");
}
}
}
@@ -117,7 +117,7 @@ export function useAuthDialogState(accessRequest: boolean, providerId: string |
isTooManySessions: false,
forceSessionsLogout: false,
switchAuthMode(tabId: string | null, resetError = true): void {
if (tabId === this.tabId) {
if (tabId !== null && tabId === this.tabId) {
return;
}