2014-08-08 16:49:02 +02:00
|
|
|
package com.commafeed;
|
|
|
|
|
|
2024-08-07 08:10:14 +02:00
|
|
|
import java.time.Duration;
|
2024-01-08 20:42:45 +01:00
|
|
|
import java.time.Instant;
|
2024-08-07 08:10:14 +02:00
|
|
|
import java.util.Optional;
|
|
|
|
|
|
|
|
|
|
import com.commafeed.backend.feed.FeedRefreshIntervalCalculator;
|
|
|
|
|
|
|
|
|
|
import io.quarkus.runtime.configuration.MemorySize;
|
|
|
|
|
import io.smallrye.config.ConfigMapping;
|
|
|
|
|
import io.smallrye.config.WithDefault;
|
2023-12-17 14:11:15 +01:00
|
|
|
import jakarta.validation.constraints.Min;
|
|
|
|
|
import jakarta.validation.constraints.Positive;
|
2024-08-07 08:10:14 +02:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* CommaFeed configuration
|
|
|
|
|
*
|
|
|
|
|
* Default values are for production, they can be overridden in application.properties
|
|
|
|
|
*/
|
|
|
|
|
@ConfigMapping(prefix = "commafeed")
|
|
|
|
|
public interface CommaFeedConfiguration {
|
|
|
|
|
/**
|
|
|
|
|
* Whether to expose a robots.txt file that disallows web crawlers and search engine indexers.
|
|
|
|
|
*/
|
|
|
|
|
@WithDefault("true")
|
|
|
|
|
boolean hideFromWebCrawlers();
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* If enabled, images in feed entries will be proxied through the server instead of accessed directly by the browser.
|
|
|
|
|
*
|
|
|
|
|
* This is useful if commafeed is accessed through a restricting proxy that blocks some feeds that are followed.
|
|
|
|
|
*/
|
|
|
|
|
@WithDefault("false")
|
|
|
|
|
boolean imageProxyEnabled();
|
|
|
|
|
|
2024-08-12 09:41:14 +02:00
|
|
|
/**
|
|
|
|
|
* Enable password recovery via email.
|
|
|
|
|
*
|
|
|
|
|
* Quarkus mailer will need to be configured.
|
|
|
|
|
*/
|
|
|
|
|
@WithDefault("false")
|
|
|
|
|
boolean passwordRecoveryEnabled();
|
|
|
|
|
|
2024-08-07 08:10:14 +02:00
|
|
|
/**
|
|
|
|
|
* Message displayed in a notification at the bottom of the page.
|
|
|
|
|
*/
|
|
|
|
|
Optional<String> announcement();
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Google Analytics tracking code.
|
|
|
|
|
*/
|
|
|
|
|
Optional<String> googleAnalyticsTrackingCode();
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Google Auth key for fetching Youtube favicons.
|
|
|
|
|
*/
|
|
|
|
|
Optional<String> googleAuthKey();
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Feed refresh engine settings.
|
|
|
|
|
*/
|
|
|
|
|
FeedRefresh feedRefresh();
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Database settings.
|
|
|
|
|
*/
|
|
|
|
|
Database database();
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Users settings.
|
|
|
|
|
*/
|
|
|
|
|
Users users();
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Websocket settings.
|
|
|
|
|
*/
|
|
|
|
|
Websocket websocket();
|
|
|
|
|
|
|
|
|
|
interface FeedRefresh {
|
|
|
|
|
/**
|
|
|
|
|
* Amount of time CommaFeed will wait before refreshing the same feed.
|
|
|
|
|
*/
|
|
|
|
|
@WithDefault("5m")
|
|
|
|
|
Duration interval();
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* If true, CommaFeed will calculate the next refresh time based on the feed's average entry interval and the time since the last
|
|
|
|
|
* entry was published. See {@link FeedRefreshIntervalCalculator} for details.
|
|
|
|
|
*/
|
|
|
|
|
@WithDefault("false")
|
|
|
|
|
boolean intervalEmpirical();
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Amount of http threads used to fetch feeds.
|
|
|
|
|
*/
|
|
|
|
|
@Min(1)
|
|
|
|
|
@WithDefault("3")
|
|
|
|
|
int httpThreads();
|
2014-08-08 16:49:02 +02:00
|
|
|
|
2024-08-07 08:10:14 +02:00
|
|
|
/**
|
|
|
|
|
* Amount of threads used to insert new entries in the database.
|
|
|
|
|
*/
|
|
|
|
|
@Min(1)
|
|
|
|
|
@WithDefault("1")
|
|
|
|
|
int databaseThreads();
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* If a feed is larger than this, it will be discarded to prevent memory issues while parsing the feed.
|
|
|
|
|
*/
|
|
|
|
|
@WithDefault("5M")
|
|
|
|
|
MemorySize maxResponseSize();
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Duration after which a user is considered inactive. Feeds for inactive users are not refreshed until they log in again.
|
2024-08-13 12:39:59 +02:00
|
|
|
*
|
|
|
|
|
* 0 to disable.
|
2024-08-07 08:10:14 +02:00
|
|
|
*/
|
|
|
|
|
@WithDefault("0")
|
|
|
|
|
Duration userInactivityPeriod();
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* User-Agent string that will be used by the http client, leave empty for the default one.
|
|
|
|
|
*/
|
|
|
|
|
Optional<String> userAgent();
|
2014-08-09 13:26:03 +02:00
|
|
|
}
|
|
|
|
|
|
2024-08-07 08:10:14 +02:00
|
|
|
interface Database {
|
|
|
|
|
/**
|
|
|
|
|
* Database query timeout.
|
|
|
|
|
*/
|
|
|
|
|
@WithDefault("0")
|
|
|
|
|
int queryTimeout();
|
|
|
|
|
|
|
|
|
|
Cleanup cleanup();
|
|
|
|
|
|
|
|
|
|
interface Cleanup {
|
|
|
|
|
/**
|
2024-08-13 12:39:59 +02:00
|
|
|
* Maximum age of feed entries in the database. Older entries will be deleted.
|
|
|
|
|
*
|
|
|
|
|
* 0 to disable.
|
2024-08-07 08:10:14 +02:00
|
|
|
*/
|
|
|
|
|
@WithDefault("365d")
|
|
|
|
|
Duration entriesMaxAge();
|
|
|
|
|
|
|
|
|
|
/**
|
2024-08-13 12:39:59 +02:00
|
|
|
* Maximum age of feed entry statuses (read/unread) in the database. Older statuses will be deleted.
|
|
|
|
|
*
|
|
|
|
|
* 0 to disable.
|
2024-08-07 08:10:14 +02:00
|
|
|
*/
|
|
|
|
|
@WithDefault("0")
|
|
|
|
|
Duration statusesMaxAge();
|
|
|
|
|
|
|
|
|
|
/**
|
2024-08-13 12:39:59 +02:00
|
|
|
* Maximum number of entries per feed to keep in the database.
|
|
|
|
|
*
|
|
|
|
|
* 0 to disable.
|
2024-08-07 08:10:14 +02:00
|
|
|
*/
|
|
|
|
|
@WithDefault("500")
|
|
|
|
|
int maxFeedCapacity();
|
|
|
|
|
|
|
|
|
|
/**
|
2024-08-13 12:39:59 +02:00
|
|
|
* Limit the number of feeds a user can subscribe to.
|
|
|
|
|
*
|
|
|
|
|
* 0 to disable.
|
2024-08-07 08:10:14 +02:00
|
|
|
*/
|
|
|
|
|
@WithDefault("0")
|
|
|
|
|
int maxFeedsPerUser();
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Rows to delete per query while cleaning up old entries.
|
|
|
|
|
*/
|
|
|
|
|
@Positive
|
|
|
|
|
@WithDefault("100")
|
|
|
|
|
int batchSize();
|
|
|
|
|
|
|
|
|
|
default Instant statusesInstantThreshold() {
|
|
|
|
|
return statusesMaxAge().toMillis() > 0 ? Instant.now().minus(statusesMaxAge()) : null;
|
2024-01-09 14:53:13 +01:00
|
|
|
}
|
|
|
|
|
}
|
2014-08-16 17:27:27 +02:00
|
|
|
}
|
|
|
|
|
|
2024-08-07 08:10:14 +02:00
|
|
|
interface Users {
|
|
|
|
|
/**
|
|
|
|
|
* Whether to let users create accounts for themselves.
|
|
|
|
|
*/
|
|
|
|
|
@WithDefault("false")
|
|
|
|
|
boolean allowRegistrations();
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Whether to enable strict password validation (1 uppercase char, 1 lowercase char, 1 digit, 1 special char).
|
|
|
|
|
*/
|
|
|
|
|
@WithDefault("true")
|
|
|
|
|
boolean strictPasswordPolicy();
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Whether to create a demo account the first time the app starts.
|
|
|
|
|
*/
|
|
|
|
|
@WithDefault("false")
|
|
|
|
|
boolean createDemoAccount();
|
|
|
|
|
}
|
2014-08-08 16:49:02 +02:00
|
|
|
|
2024-08-07 08:10:14 +02:00
|
|
|
interface Websocket {
|
|
|
|
|
/**
|
|
|
|
|
* Enable websocket connection so the server can notify the web client that there are new entries for your feeds.
|
|
|
|
|
*/
|
|
|
|
|
@WithDefault("true")
|
|
|
|
|
boolean enabled();
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Interval at which the client will send a ping message on the websocket to keep the connection alive.
|
|
|
|
|
*/
|
|
|
|
|
@WithDefault("15m")
|
|
|
|
|
Duration pingInterval();
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* If the websocket connection is disabled or the connection is lost, the client will reload the feed tree at this interval.
|
|
|
|
|
*/
|
|
|
|
|
@WithDefault("30s")
|
|
|
|
|
Duration treeReloadInterval();
|
|
|
|
|
}
|
2014-08-08 16:49:02 +02:00
|
|
|
|
|
|
|
|
}
|