add settings documentation

This commit is contained in:
Athou
2024-08-18 21:15:48 +02:00
parent ff9374f1ed
commit 4db0c775ff
6 changed files with 633 additions and 4 deletions

View File

@@ -61,8 +61,8 @@ services:
## Configuration
All [CommaFeed settings](https://github.com/Athou/commafeed/blob/master/commafeed-server/src/main/java/com/commafeed/CommaFeedConfiguration.java)
are optional and have sensible default values.
All [CommaFeed settings](https://github.com/Athou/commafeed/blob/master/commafeed-server/doc/commafeed.adoc) are
optional and have sensible default values.
Settings are overrideable with environment variables. For instance, `config.feedRefresh().intervalEmpirical()` can be
set

View File

@@ -6,6 +6,8 @@ import java.util.Optional;
import com.commafeed.backend.feed.FeedRefreshIntervalCalculator;
import io.quarkus.runtime.annotations.ConfigPhase;
import io.quarkus.runtime.annotations.ConfigRoot;
import io.quarkus.runtime.configuration.MemorySize;
import io.smallrye.config.ConfigMapping;
import io.smallrye.config.WithDefault;
@@ -18,6 +20,7 @@ import jakarta.validation.constraints.Positive;
* Default values are for production, they can be overridden in application.properties for other profiles
*/
@ConfigMapping(prefix = "commafeed")
@ConfigRoot(phase = ConfigPhase.RUN_TIME)
public interface CommaFeedConfiguration {
/**
* Whether to expose a robots.txt file that disallows web crawlers and search engine indexers.
@@ -184,6 +187,9 @@ public interface CommaFeedConfiguration {
@WithDefault("0")
Duration queryTimeout();
/**
* Database cleanup settings.
*/
Cleanup cleanup();
interface Cleanup {

View File

@@ -0,0 +1,22 @@
package com.commafeed;
import java.io.File;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import org.apache.commons.io.FileUtils;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
class CommaFeedConfigurationTest {
@Test
void verifyAsciiDocIsUpToDate() throws IOException {
String versionedDocumentationFile = FileUtils.readFileToString(new File("doc/commafeed.adoc"), StandardCharsets.UTF_8);
String generatedDocumentationFile = FileUtils.readFileToString(new File("../target/asciidoc/generated/config/commafeed.adoc"),
StandardCharsets.UTF_8);
Assertions.assertLinesMatch(versionedDocumentationFile.lines(), generatedDocumentationFile.lines());
}
}