Use GEO_INTERNAL_URL/EXTERNAL_URL for hubs
This commit is contained in:
@@ -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():
|
||||
|
||||
Reference in New Issue
Block a user