From b8eccfb4c76b6474eaa70acd0221361b433cd5a8 Mon Sep 17 00:00:00 2001 From: Krystle Salazar Date: Mon, 26 Feb 2024 17:02:38 -0400 Subject: [PATCH] Add CANONICAL_DOMAIN variable and derive CANONICAL_ORIGIN from it --- catalog/dags/common/loader/provider_details.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/catalog/dags/common/loader/provider_details.py b/catalog/dags/common/loader/provider_details.py index 08b805bfb5e..5164a4c8f25 100644 --- a/catalog/dags/common/loader/provider_details.py +++ b/catalog/dags/common/loader/provider_details.py @@ -124,7 +124,12 @@ # User-Agent header for APIs that require it CONTACT_EMAIL = os.getenv("CONTACT_EMAIL") -CANONICAL_ORIGIN = os.getenv("CANONICAL_ORIGIN", "https://openverse.org") + +CANONICAL_DOMAIN: str = os.getenv("CANONICAL_DOMAIN", "openverse.org") # required + +_proto = "http" if "localhost" in CANONICAL_DOMAIN else "https" +CANONICAL_ORIGIN: str = f"{_proto}://{CANONICAL_DOMAIN}" + UA_STRING = f"Openverse/0.1 ({CANONICAL_ORIGIN}; {CONTACT_EMAIL})"