From ce802830c37565d325ba2ecc060443550abb1955 Mon Sep 17 00:00:00 2001 From: Dennis Fink Date: Sun, 25 Oct 2026 22:26:40 +0100 Subject: 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. --- webmentions_ssg/tasks/scanner.py | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'webmentions_ssg/tasks/scanner.py') 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 = { -- cgit v1.3.1