aboutsummaryrefslogtreecommitdiff
path: root/webmentions_ssg/config.py
diff options
context:
space:
mode:
authorDennis Fink2026-11-15 20:42:20 +0100
committerDennis Fink2026-11-15 20:42:20 +0100
commit509d93b2976e353d29441a7a7b7e78ca466dc4fd (patch)
tree753e637aefabd4293f808addbf9c310eaf0aa552 /webmentions_ssg/config.py
parentc74feda222745ab7cca8993df83d9ea5f9d07e5b (diff)
downloadwebmentions-ssg-509d93b2976e353d29441a7a7b7e78ca466dc4fd.tar.gz
webmentions-ssg-509d93b2976e353d29441a7a7b7e78ca466dc4fd.zip
refactor(core)!: standardize application terminology
Rename configuration keys, task helpers, forms, network utilities, and view endpoints to make their responsibilities and domains more explicit. Align source-management routes and templates with the new terminology and rename the target-matching module and related task abstractions consistently. BREAKING CHANGE: configuration keys have been renamed and sent-source routes move from `/sent` to `/sources`, with corresponding blueprint endpoint changes.
Diffstat (limited to '')
-rw-r--r--webmentions_ssg/config.py40
1 files changed, 20 insertions, 20 deletions
diff --git a/webmentions_ssg/config.py b/webmentions_ssg/config.py
index 6e6b4bf..7d09e7e 100644
--- a/webmentions_ssg/config.py
+++ b/webmentions_ssg/config.py
@@ -26,12 +26,12 @@ class DefaultConfig:
LOG_FILE = "/var/log/webmentions-ssg.log"
LOG_FORMAT = "[%(asctime)s]:%(levelname)s:%(name)s %(message)s"
LOG_LEVEL = logging.INFO
- LOGFILE_MAX_BYTES = 20_000_000
- LOGFILE_BACKUP_COUNT = 10
+ LOG_FILE_MAX_BYTES = 20_000_000
+ LOG_FILE_BACKUP_COUNT = 10
SQLALCHEMY_DATABASE_URI = "sqlite:///webmentions-ssg.db"
# Empty by default: no target hostnames are accepted until configured.
- ALLOWED_HOSTNAMES = frozenset()
+ ALLOWED_TARGET_HOSTNAMES = frozenset()
# Cap incoming HTTP request bodies (also applies to other Flask routes).
MAX_CONTENT_LENGTH = 64 * 1024
# Independent UTF-8 byte limit for each submitted source/target URL.
@@ -40,28 +40,28 @@ class DefaultConfig:
RECEIVED_RETENTION_DAYS = 30
RECEIVED_RETENTION_SCHEDULE = "0 3 * * *"
MAX_REDIRECTS = 20
- MAX_SOURCE_BYTES = 1_000_000
- MAX_TARGET_BYTES = 1_000_000
- REQUEST_TIMEOUT = 5.0
+ MAX_RECEIVED_SOURCE_BYTES = 1_000_000
+ MAX_DISCOVERY_TARGET_BYTES = 1_000_000
+ REQUEST_TIMEOUT_SECONDS = 5.0
# Absolute wall-clock budget for each verification or delivery attempt.
- REQUEST_TOTAL_TIMEOUT = 30.0
+ REQUEST_TOTAL_TIMEOUT_SECONDS = 30.0
# Requeue abandoned verification attempts after 15 minutes.
- VERIFICATION_TIMEOUT_SECONDS = 900
+ VERIFICATION_STALE_AFTER_SECONDS = 900
# Maximum automatic recoveries of a stale received/verifying row.
VERIFICATION_MAX_RECOVERIES = 3
- VERIFICATION_REAPER_SCHEDULE = "*/5 * * * *"
+ VERIFICATION_RECOVERY_SCHEDULE = "*/5 * * * *"
- SOURCE_DIRECTORY = None
- SOURCE_BASE_URL = None
- IGNORED_HOSTNAMES = ()
- SCANNER_SCHEDULE = "0 * * * *"
+ SITE_OUTPUT_DIRECTORY = None
+ SITE_BASE_URL = None
+ IGNORED_TARGET_HOSTNAMES = ()
+ SOURCE_SCAN_SCHEDULE = "0 * * * *"
# Total send attempts per source revision (not additional retries).
SEND_MAX_ATTEMPTS = 6
SEND_RETRY_BASE_SECONDS = 3600
SEND_RETRY_MAX_SECONDS = 86400
- NOTIFICATION_EMAIL = None
- NOTIFICATION_SCHEDULE = "0 8 * * *"
+ DIGEST_EMAIL = None
+ DIGEST_SCHEDULE = "0 8 * * *"
MAIL_SERVER = "localhost"
MAIL_PORT = 25
@@ -116,7 +116,7 @@ class TestingConfig(DefaultConfig):
HUEY_URL = "memory://"
- ALLOWED_HOSTNAMES = frozenset({"dennisfink.me"})
+ ALLOWED_TARGET_HOSTNAMES = frozenset({"dennisfink.me"})
def normalize_hostnames(value: object) -> set[str]:
@@ -177,7 +177,7 @@ def validate_secret_key(value: object) -> str | bytes:
return value
-def validate_config(
+def validated_config_overrides(
config: Config, *, config_class: type[DefaultConfig]
) -> dict[str, object]:
"""Validate runtime configuration and return normalized values.
@@ -194,7 +194,7 @@ def validate_config(
unsafe.
"""
normalized: dict[str, object] = {}
- for key in ("ALLOWED_HOSTNAMES", "IGNORED_HOSTNAMES"):
+ for key in ("ALLOWED_TARGET_HOSTNAMES", "IGNORED_TARGET_HOSTNAMES"):
try:
normalized[key] = normalize_hostnames(config[key])
except (TypeError, ValueError) as exc:
@@ -221,9 +221,9 @@ def validate_config(
normalized["SECRET_KEY"] = validate_secret_key(config.get("SECRET_KEY"))
if not config["DEBUG"] and not config["TESTING"]:
- if not normalized["ALLOWED_HOSTNAMES"]:
+ if not normalized["ALLOWED_TARGET_HOSTNAMES"]:
raise RuntimeError(
- "Configure ALLOWED_HOSTNAMES before running in production."
+ "Configure ALLOWED_TARGET_HOSTNAMES before running in production."
)
if config["RATELIMIT_STORAGE_URI"] == "memory://":
raise RuntimeError(