allow configuration of custom logback configuration via -Dlogback.configurationFile vm arg

This commit is contained in:
Sebastian Stenzel
2019-02-25 15:54:43 +01:00
parent a09edad165
commit 3e3a4ceefc
2 changed files with 36 additions and 20 deletions
@@ -7,6 +7,7 @@ import org.slf4j.LoggerFactory;
import javax.inject.Inject;
import javax.inject.Singleton;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Optional;
@@ -27,6 +28,9 @@ public class Environment {
@Inject
public Environment() {
LOG.debug("user.language: {}", System.getProperty("user.language"));
LOG.debug("user.region: {}", System.getProperty("user.region"));
LOG.debug("logback.configurationFile: {}", System.getProperty("logback.configurationFile"));
LOG.debug("cryptomator.settingsPath: {}", System.getProperty("cryptomator.settingsPath"));
LOG.debug("cryptomator.ipcPortPath: {}", System.getProperty("cryptomator.ipcPortPath"));
LOG.debug("cryptomator.keychainPath: {}", System.getProperty("cryptomator.keychainPath"));
@@ -34,6 +38,10 @@ public class Environment {
LOG.debug("cryptomator.mountPointsDir: {}", System.getProperty("cryptomator.mountPointsDir"));
}
public boolean useCustomLogbackConfig() {
return getPath("logback.configurationFile").map(Files::exists).orElse(false);
}
public Stream<Path> getSettingsPath() {
return getPaths("cryptomator.settingsPath");
}