refactor: rename platform_domain → main_domain to avoid confusion with platform.domain
Some checks failed
CI / ruff (push) Successful in 10s
CI / validate (push) Has been cancelled
CI / dependency-scanning (push) Has been cancelled
CI / docs (push) Has been cancelled
CI / deploy (push) Has been cancelled
CI / pytest (push) Has started running

The setting `settings.platform_domain` (the global/main domain like "wizard.lu")
was easily confused with `platform.domain` (per-platform domain like "rewardflow.lu").
Renamed to `settings.main_domain` / `MAIN_DOMAIN` env var across the entire codebase.

Also updated docs to reflect the refactored store detection logic with
`is_platform_domain` / `is_subdomain_of_platform` guards.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-14 04:45:28 +01:00
parent 4a1f71a312
commit c2c0e3c740
26 changed files with 152 additions and 113 deletions

View File

@@ -144,7 +144,7 @@ def purchase_addon(
store = billing_service.get_store(db, store_id)
# Build URLs
base_url = f"https://{settings.platform_domain}"
base_url = f"https://{settings.main_domain}"
success_url = f"{base_url}/store/{store.store_code}/billing?addon_success=true"
cancel_url = f"{base_url}/store/{store.store_code}/billing?addon_cancelled=true"

View File

@@ -59,7 +59,7 @@ def create_checkout_session(
store_code = subscription_service.get_store_code(db, store_id)
base_url = f"https://{settings.platform_domain}"
base_url = f"https://{settings.main_domain}"
success_url = f"{base_url}/store/{store_code}/billing?success=true"
cancel_url = f"{base_url}/store/{store_code}/billing?cancelled=true"
@@ -87,7 +87,7 @@ def create_portal_session(
merchant_id, platform_id = subscription_service.resolve_store_to_merchant(db, store_id, current_user.token_platform_id)
store_code = subscription_service.get_store_code(db, store_id)
return_url = f"https://{settings.platform_domain}/store/{store_code}/billing"
return_url = f"https://{settings.main_domain}/store/{store_code}/billing"
result = billing_service.create_portal_session(db, merchant_id, platform_id, return_url)

View File

@@ -617,7 +617,7 @@ class SignupService:
# Build login URL
login_url = (
f"https://{settings.platform_domain}"
f"https://{settings.main_domain}"
f"/store/{store.store_code}/dashboard"
)

View File

@@ -205,7 +205,7 @@ def _build_base_context(
"request": request,
"platform": platform,
"platform_name": settings.project_name,
"platform_domain": settings.platform_domain,
"main_domain": settings.main_domain,
}
# Add i18n globals

View File

@@ -335,19 +335,19 @@ class Store(Base, TimestampMixin):
Domain Resolution Priority:
1. Store-specific custom domain (StoreDomain) -> highest priority
2. Merchant domain (MerchantDomain) -> inherited default
3. Store subdomain ({store.subdomain}.{platform_domain}) -> fallback
3. Store subdomain ({store.subdomain}.{main_domain}) -> fallback
"""
if self.primary_domain:
return self.primary_domain
if self.merchant and self.merchant.primary_domain:
return self.merchant.primary_domain
return f"{self.subdomain}.{settings.platform_domain}"
return f"{self.subdomain}.{settings.main_domain}"
@property
def all_domains(self):
"""Get all active domains (subdomain + custom domains)."""
domains = [
f"{self.subdomain}.{settings.platform_domain}"
f"{self.subdomain}.{settings.main_domain}"
] # Start with the main subdomain
for domain in self.domains:
if domain.is_active: