mirror of
https://github.com/dbeaver/cloudbeaver.git
synced 2026-10-16 14:50:15 +08:00
Compare commits
4
Commits
release_26_1_5
...
24.1.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
32b967b18f | ||
|
|
df97d90756 | ||
|
|
f19e93749e | ||
|
|
96621eadd3 |
+3
-10
@@ -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;
|
||||
|
||||
+26
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user