From 4a8e69f3c33d6098583b2bfe60ccca78cc7994c7 Mon Sep 17 00:00:00 2001 From: Ruslan Bakiev <572431+veikab@users.noreply.github.com> Date: Thu, 5 Feb 2026 14:51:54 +0700 Subject: [PATCH] Use GEO_INTERNAL_URL/EXTERNAL_URL for hubs --- offers/management/commands/seed_exchange.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/offers/management/commands/seed_exchange.py b/offers/management/commands/seed_exchange.py index 5392a87..2f902a5 100644 --- a/offers/management/commands/seed_exchange.py +++ b/offers/management/commands/seed_exchange.py @@ -206,10 +206,16 @@ class Command(BaseCommand): use_bulk = options["bulk"] bulk_size = max(1, options["bulk_size"]) sleep_ms = max(0, options["sleep_ms"]) - geo_url = options["geo_url"] or os.getenv("GEO_INTERNAL_URL") or os.getenv("GEO_URL") + geo_url = ( + options["geo_url"] + or os.getenv("GEO_INTERNAL_URL") + or os.getenv("GEO_EXTERNAL_URL") + or os.getenv("GEO_URL") + ) if not geo_url: self.stdout.write(self.style.ERROR("Geo URL is not set. Provide --geo-url or GEO_INTERNAL_URL.")) return + geo_url = self._normalize_geo_url(geo_url) odoo_url = options["odoo_url"] product_filter = options["product"] ensure_products = options["ensure_products"] @@ -690,6 +696,15 @@ class Command(BaseCommand): return name return None + def _normalize_geo_url(self, url: str) -> str: + """Ensure geo URL has scheme and GraphQL path.""" + value = url.strip() + if not value.startswith(("http://", "https://")): + value = f"http://{value}" + if "/graphql" not in value: + value = value.rstrip("/") + "/graphql/public/" + return value + def _price_for_product(self, product_name: str) -> Decimal: for item in PRODUCT_CATALOG: if item["name"].lower() == product_name.lower():