aboutsummaryrefslogtreecommitdiff
path: root/webmentions_ssg/tasks/scanner.py
diff options
context:
space:
mode:
authorDennis Fink2026-10-25 22:26:40 +0100
committerDennis Fink2026-10-25 22:26:40 +0100
commitce802830c37565d325ba2ecc060443550abb1955 (patch)
treeb2cdf65353b1eb28d2c8d394b0dcd24461c4db6c /webmentions_ssg/tasks/scanner.py
parenta231913ab273f427697f2d27d615b495f6e160bb (diff)
downloadwebmentions-ssg-ce802830c37565d325ba2ecc060443550abb1955.tar.gz
webmentions-ssg-ce802830c37565d325ba2ecc060443550abb1955.zip
refactor(core): simplify configuration keys
Remove the WEBMENTIONS_SSG prefix from application-specific configuration settings and update validators, tasks, and tests to use the shorter names.
Diffstat (limited to 'webmentions_ssg/tasks/scanner.py')
-rw-r--r--webmentions_ssg/tasks/scanner.py15
1 files changed, 6 insertions, 9 deletions
diff --git a/webmentions_ssg/tasks/scanner.py b/webmentions_ssg/tasks/scanner.py
index 17898ba..1980abb 100644
--- a/webmentions_ssg/tasks/scanner.py
+++ b/webmentions_ssg/tasks/scanner.py
@@ -79,7 +79,7 @@ def canonical_url(
if base_url is None:
raise SourceScanError(
"Document contains a relative canonical URL, but "
- "WEBMENTIONS_SSG_SOURCE_BASE_URL is not configured"
+ "SOURCE_BASE_URL is not configured"
)
resolved = urljoin(source_url_for_path(relative_path, base_url), href)
@@ -292,8 +292,7 @@ def scan_source_file(
if source_url is None:
if base_url is None:
raise SourceScanError(
- "Document has no canonical URL and "
- "WEBMENTIONS_SSG_SOURCE_BASE_URL is not configured"
+ "Document has no canonical URL and SOURCE_BASE_URL is not configured"
)
source_url = source_url_for_path(relative_path, base_url)
@@ -410,7 +409,7 @@ def scan_sources() -> None:
:raises RuntimeError: If the configured source directory or base URL is
invalid.
"""
- directory = current_app.config.get("WEBMENTIONS_SSG_SOURCE_DIRECTORY")
+ directory = current_app.config.get("SOURCE_DIRECTORY")
if directory is None:
return
@@ -420,18 +419,16 @@ def scan_sources() -> None:
if not root.is_dir():
raise RuntimeError(f"Source directory is not a directory: {root}")
- base_url = current_app.config.get("WEBMENTIONS_SSG_SOURCE_BASE_URL")
+ base_url = current_app.config.get("SOURCE_BASE_URL")
if base_url is not None:
if not is_http_url(base_url):
- raise RuntimeError(
- "WEBMENTIONS_SSG_SOURCE_BASE_URL must be an absolute HTTP or HTTPS URL"
- )
+ raise RuntimeError("SOURCE_BASE_URL must be an absolute HTTP or HTTPS URL")
base_url = f"{base_url.rstrip('/')}/"
ignored_hostnames = tuple(
pattern.lower().rstrip(".")
- for pattern in current_app.config.get("WEBMENTIONS_SSG_IGNORED_HOSTNAMES", ())
+ for pattern in current_app.config.get("IGNORED_HOSTNAMES", ())
)
sources_by_path = {