| | |
| | | package de.micromata.borgbutler.server; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonIgnore; |
| | | import com.fasterxml.jackson.annotation.JsonProperty; |
| | | import de.micromata.borgbutler.config.Configuration; |
| | | import de.micromata.borgbutler.config.ConfigurationHandler; |
| | | import lombok.Getter; |
| | | import lombok.Setter; |
| | | import org.apache.commons.lang3.StringUtils; |
| | |
| | | |
| | | import java.beans.Transient; |
| | | |
| | | public class ServerConfiguration { |
| | | public class ServerConfiguration extends Configuration { |
| | | private static Logger log = LoggerFactory.getLogger(ServerConfiguration.class); |
| | | private final static String[] SUPPORTED_LANGUAGES = {"en", "de"}; |
| | | public static final int WEBSERVER_PORT_DEFAULT = 9042; |
| | | private static final boolean SHOW_TEST_DATA_PREF_DEFAULT = false; |
| | | private static final boolean WEB_DEVELOPMENT_MODE_PREF_DEFAULT = false; |
| | | |
| | | private static String applicationHome; |
| | | |
| | | private int port; |
| | | private int port = WEBSERVER_PORT_DEFAULT; |
| | | @Getter |
| | | @Setter |
| | | private boolean showTestData = true; |
| | | private boolean webDevelopmentMode = false; |
| | | private boolean templatesDirModified = false; |
| | | @JsonIgnore |
| | | private boolean showTestData = SHOW_TEST_DATA_PREF_DEFAULT; |
| | | private boolean webDevelopmentMode = WEB_DEVELOPMENT_MODE_PREF_DEFAULT; |
| | | |
| | | public static ServerConfiguration getDefault() { |
| | | return ServerConfigurationHandler.getDefaultConfiguration(); |
| | | public static ServerConfiguration get() { |
| | | return (ServerConfiguration)ConfigurationHandler.getConfiguration(); |
| | | } |
| | | |
| | | public static String[] getSupportedLanguages() { |
| | |
| | | return applicationHome; |
| | | } |
| | | |
| | | public void resetModifiedFlag() { |
| | | templatesDirModified = false; |
| | | } |
| | | |
| | | @Transient |
| | | public boolean isTemplatesDirModified() { |
| | | return templatesDirModified; |
| | | } |
| | | |
| | | public int getPort() { |
| | | return port; |
| | | } |
| | |
| | | } |
| | | |
| | | public void copyFrom(ServerConfiguration other) { |
| | | super.copyFrom(other); |
| | | this.port = other.port; |
| | | this.showTestData = other.showTestData; |
| | | this.webDevelopmentMode = other.webDevelopmentMode; |