Stirling-PDF/src/main/java/stirling/software/SPDF/model/ApplicationProperties.java

350 lines
7.9 KiB
Java
Raw Normal View History

2023-08-26 18:30:49 +02:00
package stirling.software.SPDF.model;
2023-08-27 01:39:22 +02:00
import java.util.List;
2023-08-26 18:30:49 +02:00
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
import stirling.software.SPDF.config.YamlPropertySourceFactory;
@Configuration
@ConfigurationProperties(prefix = "")
2023-08-26 23:33:23 +02:00
@PropertySource(value = "file:./configs/settings.yml", factory = YamlPropertySourceFactory.class)
2023-08-26 18:30:49 +02:00
public class ApplicationProperties {
private Security security;
private System system;
private Ui ui;
private Endpoints endpoints;
private Metrics metrics;
private AutomaticallyGenerated automaticallyGenerated;
2023-08-26 23:33:23 +02:00
private AutoPipeline autoPipeline;
public AutoPipeline getAutoPipeline() {
return autoPipeline != null ? autoPipeline : new AutoPipeline();
}
public void setAutoPipeline(AutoPipeline autoPipeline) {
this.autoPipeline = autoPipeline;
}
2023-08-26 18:30:49 +02:00
public Security getSecurity() {
return security != null ? security : new Security();
}
public void setSecurity(Security security) {
this.security = security;
}
public System getSystem() {
return system != null ? system : new System();
}
public void setSystem(System system) {
this.system = system;
}
public Ui getUi() {
return ui != null ? ui : new Ui();
}
public void setUi(Ui ui) {
this.ui = ui;
}
public Endpoints getEndpoints() {
return endpoints != null ? endpoints : new Endpoints();
}
public void setEndpoints(Endpoints endpoints) {
this.endpoints = endpoints;
}
public Metrics getMetrics() {
return metrics != null ? metrics : new Metrics();
}
public void setMetrics(Metrics metrics) {
this.metrics = metrics;
}
public AutomaticallyGenerated getAutomaticallyGenerated() {
return automaticallyGenerated != null ? automaticallyGenerated : new AutomaticallyGenerated();
}
public void setAutomaticallyGenerated(AutomaticallyGenerated automaticallyGenerated) {
this.automaticallyGenerated = automaticallyGenerated;
}
2023-08-26 23:33:23 +02:00
2023-08-26 18:30:49 +02:00
@Override
public String toString() {
return "ApplicationProperties [security=" + security + ", system=" + system + ", ui=" + ui + ", endpoints="
2023-08-26 23:33:23 +02:00
+ endpoints + ", metrics=" + metrics + ", automaticallyGenerated=" + automaticallyGenerated
+ ", autoPipeline=" + autoPipeline + "]";
2023-08-26 18:30:49 +02:00
}
2023-08-26 23:33:23 +02:00
public static class AutoPipeline {
private String outputFolder;
2023-08-26 18:30:49 +02:00
2023-08-26 23:33:23 +02:00
public String getOutputFolder() {
return outputFolder;
}
public void setOutputFolder(String outputFolder) {
this.outputFolder = outputFolder;
}
@Override
public String toString() {
return "AutoPipeline [outputFolder=" + outputFolder + "]";
}
}
2023-08-26 18:30:49 +02:00
public static class Security {
private Boolean enableLogin;
private Boolean csrfDisabled;
2023-09-30 00:58:37 +02:00
private InitialLogin initialLogin;
2023-08-26 18:30:49 +02:00
2023-09-30 00:58:37 +02:00
public InitialLogin getInitialLogin() {
return initialLogin != null ? initialLogin : new InitialLogin();
}
public void setInitialLogin(InitialLogin initialLogin) {
this.initialLogin = initialLogin;
}
2023-08-26 18:30:49 +02:00
public Boolean getEnableLogin() {
return enableLogin;
}
public void setEnableLogin(Boolean enableLogin) {
this.enableLogin = enableLogin;
}
public Boolean getCsrfDisabled() {
return csrfDisabled;
}
public void setCsrfDisabled(Boolean csrfDisabled) {
this.csrfDisabled = csrfDisabled;
}
@Override
public String toString() {
2023-09-30 00:58:37 +02:00
return "Security [enableLogin=" + enableLogin + ", initialLogin=" + initialLogin + ", csrfDisabled="
2023-08-26 18:30:49 +02:00
+ csrfDisabled + "]";
}
2023-09-30 00:58:37 +02:00
public static class InitialLogin {
private String username;
private String password;
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
@Override
public String toString() {
return "InitialLogin [username=" + username + ", password=" + (password != null && !password.isEmpty() ? "MASKED" : "NULL") + "]";
}
}
2023-08-26 18:30:49 +02:00
}
public static class System {
private String defaultLocale;
private Boolean googlevisibility;
2023-08-27 01:38:17 +02:00
private String rootURIPath;
private String customStaticFilePath;
2023-08-26 18:30:49 +02:00
private Integer maxFileSize;
2023-12-26 21:10:37 +01:00
private Boolean enableAlphaFunctionality;
public Boolean getEnableAlphaFunctionality() {
return enableAlphaFunctionality;
}
public void setEnableAlphaFunctionality(Boolean enableAlphaFunctionality) {
this.enableAlphaFunctionality = enableAlphaFunctionality;
}
2023-08-26 18:30:49 +02:00
public String getDefaultLocale() {
return defaultLocale;
}
public void setDefaultLocale(String defaultLocale) {
this.defaultLocale = defaultLocale;
}
public Boolean getGooglevisibility() {
return googlevisibility;
}
public void setGooglevisibility(Boolean googlevisibility) {
this.googlevisibility = googlevisibility;
}
2023-08-27 01:38:17 +02:00
public String getRootURIPath() {
return rootURIPath;
2023-08-26 18:30:49 +02:00
}
2023-08-27 01:38:17 +02:00
public void setRootURIPath(String rootURIPath) {
this.rootURIPath = rootURIPath;
2023-08-26 18:30:49 +02:00
}
2023-08-27 01:38:17 +02:00
public String getCustomStaticFilePath() {
return customStaticFilePath;
2023-08-26 18:30:49 +02:00
}
2023-08-27 01:38:17 +02:00
public void setCustomStaticFilePath(String customStaticFilePath) {
this.customStaticFilePath = customStaticFilePath;
2023-08-26 18:30:49 +02:00
}
public Integer getMaxFileSize() {
return maxFileSize;
}
public void setMaxFileSize(Integer maxFileSize) {
this.maxFileSize = maxFileSize;
}
@Override
public String toString() {
2023-12-26 21:10:37 +01:00
return "System [defaultLocale=" + defaultLocale + ", googlevisibility=" + googlevisibility
+ ", rootURIPath=" + rootURIPath + ", customStaticFilePath=" + customStaticFilePath
+ ", maxFileSize=" + maxFileSize + ", enableAlphaFunctionality=" + enableAlphaFunctionality + "]";
2023-08-26 18:30:49 +02:00
}
2023-12-26 21:10:37 +01:00
2023-08-26 18:30:49 +02:00
}
public static class Ui {
2023-08-27 01:38:17 +02:00
private String appName;
private String homeDescription;
private String appNameNavbar;
public String getAppName() {
2023-10-08 00:35:28 +02:00
if(appName != null && appName.trim().length() == 0)
return null;
2023-08-27 01:38:17 +02:00
return appName;
}
public void setAppName(String appName) {
this.appName = appName;
}
public String getHomeDescription() {
2023-10-08 00:35:28 +02:00
if(homeDescription != null && homeDescription.trim().length() == 0)
return null;
2023-08-27 01:38:17 +02:00
return homeDescription;
}
public void setHomeDescription(String homeDescription) {
this.homeDescription = homeDescription;
}
public String getAppNameNavbar() {
2023-10-08 00:35:28 +02:00
if(appNameNavbar != null && appNameNavbar.trim().length() == 0)
return null;
2023-08-27 01:38:17 +02:00
return appNameNavbar;
}
public void setAppNameNavbar(String appNameNavbar) {
this.appNameNavbar = appNameNavbar;
}
@Override
public String toString() {
return "UserInterface [appName=" + appName + ", homeDescription=" + homeDescription + ", appNameNavbar=" + appNameNavbar + "]";
}
2023-08-26 18:30:49 +02:00
}
2023-08-27 01:38:17 +02:00
2023-08-26 18:30:49 +02:00
public static class Endpoints {
private List<String> toRemove;
private List<String> groupsToRemove;
public List<String> getToRemove() {
return toRemove;
}
public void setToRemove(List<String> toRemove) {
this.toRemove = toRemove;
}
public List<String> getGroupsToRemove() {
return groupsToRemove;
}
public void setGroupsToRemove(List<String> groupsToRemove) {
this.groupsToRemove = groupsToRemove;
}
@Override
public String toString() {
return "Endpoints [toRemove=" + toRemove + ", groupsToRemove=" + groupsToRemove + "]";
}
}
public static class Metrics {
private Boolean enabled;
public Boolean getEnabled() {
return enabled;
}
public void setEnabled(Boolean enabled) {
this.enabled = enabled;
}
@Override
public String toString() {
return "Metrics [enabled=" + enabled + "]";
}
}
public static class AutomaticallyGenerated {
private String key;
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
@Override
public String toString() {
return "AutomaticallyGenerated [key=" + (key != null && !key.isEmpty() ? "MASKED" : "NULL") + "]";
}
}
}