2026-05-11 19:40:18 +02:00

65 lines
1.6 KiB
Java

package de.opcua.app.config;
import de.opcua.app.logging.ScriptLogger;
/**
* Enhanced Settings with HTTP/HTTPS configuration
*/
public record Settings(
String endpoint,
String host,
// HTTP Configuration
boolean httpEnabled,
int httpPort,
// HTTPS Configuration
boolean httpsEnabled,
int httpsPort,
String keystorePath,
String keystorePassword,
String keystoreType,
// Script Logging
boolean scriptLoggingEnabled,
String scriptLogLevel,
String scriptLogDirectory
) {
// Default constructor with sensible defaults
public Settings() {
this(
"opc.tcp://opcuaserver.com:48010",
"http://localhost:8080",
true, // HTTP enabled by default
8081, // HTTP port
false, // HTTPS disabled by default
8443, // HTTPS port
"",
"",
"JKS",
true,
"INFO",
System.getProperty("user.home") + "/.opcua-gui/logs"
);
}
// Backward compatibility - old constructor
public Settings(String listener, String endpoint, String host) {
this(endpoint, host, true, 8081, false, 8443, "", "", "JKS",
true, "INFO", System.getProperty("user.home") + "/.opcua-gui/logs");
}
public static Settings defaults() {
return new Settings();
}
public ScriptLogger.Level getLogLevel() {
try {
return ScriptLogger.Level.valueOf(scriptLogLevel.toUpperCase());
} catch (Exception e) {
return ScriptLogger.Level.INFO;
}
}
}