2014-08-08 16:49:02 +02:00
|
|
|
package com.commafeed;
|
|
|
|
|
|
|
|
|
|
import io.dropwizard.Configuration;
|
|
|
|
|
import io.dropwizard.db.DataSourceFactory;
|
|
|
|
|
|
|
|
|
|
import java.util.Date;
|
|
|
|
|
|
|
|
|
|
import javax.validation.Valid;
|
|
|
|
|
import javax.validation.constraints.NotNull;
|
|
|
|
|
|
|
|
|
|
import lombok.Getter;
|
|
|
|
|
|
|
|
|
|
import org.apache.commons.lang.time.DateUtils;
|
|
|
|
|
|
|
|
|
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
|
|
|
|
|
|
|
|
|
@Getter
|
|
|
|
|
public class CommaFeedConfiguration extends Configuration {
|
|
|
|
|
|
2014-08-09 13:26:03 +02:00
|
|
|
public static enum CacheType {
|
|
|
|
|
NOOP, REDIS
|
|
|
|
|
}
|
|
|
|
|
|
2014-08-08 16:49:02 +02:00
|
|
|
@Valid
|
|
|
|
|
@NotNull
|
|
|
|
|
@JsonProperty("database")
|
|
|
|
|
private DataSourceFactory database = new DataSourceFactory();
|
|
|
|
|
|
|
|
|
|
@Valid
|
|
|
|
|
@NotNull
|
|
|
|
|
@JsonProperty("app")
|
|
|
|
|
private ApplicationSettings applicationSettings;
|
|
|
|
|
|
|
|
|
|
@Getter
|
|
|
|
|
public static class ApplicationSettings {
|
2014-08-16 07:05:49 +02:00
|
|
|
@JsonProperty
|
|
|
|
|
private String contextPath;
|
|
|
|
|
|
2014-08-08 16:49:02 +02:00
|
|
|
@JsonProperty
|
|
|
|
|
private String publicUrl;
|
|
|
|
|
|
|
|
|
|
@JsonProperty
|
|
|
|
|
private boolean allowRegistrations;
|
|
|
|
|
|
|
|
|
|
@JsonProperty
|
|
|
|
|
private String googleAnalyticsTrackingCode;
|
|
|
|
|
|
|
|
|
|
@JsonProperty
|
|
|
|
|
private int backgroundThreads;
|
|
|
|
|
|
|
|
|
|
@JsonProperty
|
|
|
|
|
private int databaseUpdateThreads;
|
|
|
|
|
|
|
|
|
|
@JsonProperty
|
|
|
|
|
private String smtpHost;
|
|
|
|
|
|
|
|
|
|
@JsonProperty
|
|
|
|
|
private int smtpPort;
|
|
|
|
|
|
|
|
|
|
@JsonProperty
|
|
|
|
|
private boolean smtpTls;
|
|
|
|
|
|
|
|
|
|
@JsonProperty
|
|
|
|
|
private String smtpUserName;
|
|
|
|
|
|
|
|
|
|
@JsonProperty
|
|
|
|
|
private String smtpPassword;
|
|
|
|
|
|
|
|
|
|
@JsonProperty
|
|
|
|
|
private boolean heavyLoad;
|
|
|
|
|
|
|
|
|
|
@JsonProperty
|
|
|
|
|
private boolean pubsubhubbub;
|
|
|
|
|
|
|
|
|
|
@JsonProperty
|
|
|
|
|
private boolean imageProxyEnabled;
|
|
|
|
|
|
|
|
|
|
@JsonProperty
|
|
|
|
|
private int queryTimeout;
|
|
|
|
|
|
|
|
|
|
@JsonProperty
|
|
|
|
|
private int keepStatusDays;
|
|
|
|
|
|
|
|
|
|
@JsonProperty
|
|
|
|
|
private int refreshIntervalMinutes;
|
|
|
|
|
|
2014-08-09 13:26:03 +02:00
|
|
|
@JsonProperty
|
|
|
|
|
private CacheType cache;
|
|
|
|
|
|
2014-08-08 16:49:02 +02:00
|
|
|
@JsonProperty
|
|
|
|
|
private String announcement;
|
|
|
|
|
|
|
|
|
|
public Date getUnreadThreshold() {
|
|
|
|
|
int keepStatusDays = getKeepStatusDays();
|
|
|
|
|
return keepStatusDays > 0 ? DateUtils.addDays(new Date(), -1 * keepStatusDays) : null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|