refactor: rename platform_domain → main_domain to avoid confusion with platform.domain
Some checks failed
Some checks failed
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:
@@ -390,14 +390,14 @@ def create_admin_settings(db: Session) -> int:
|
||||
},
|
||||
{
|
||||
"key": "platform_url",
|
||||
"value": f"https://{settings.platform_domain}",
|
||||
"value": f"https://{settings.main_domain}",
|
||||
"value_type": "string",
|
||||
"description": "Main platform URL",
|
||||
"is_public": True,
|
||||
},
|
||||
{
|
||||
"key": "support_email",
|
||||
"value": f"support@{settings.platform_domain}",
|
||||
"value": f"support@{settings.main_domain}",
|
||||
"value_type": "string",
|
||||
"description": "Platform support email",
|
||||
"is_public": True,
|
||||
|
||||
@@ -339,7 +339,7 @@ def validate_configuration(env_vars: dict) -> dict:
|
||||
# -------------------------------------------------------------------------
|
||||
# Platform Domain
|
||||
# -------------------------------------------------------------------------
|
||||
domain = env_vars.get("PLATFORM_DOMAIN", "orion.lu")
|
||||
domain = env_vars.get("MAIN_DOMAIN", "orion.lu")
|
||||
if domain != "orion.lu":
|
||||
results["domain"] = {
|
||||
"status": "ok",
|
||||
@@ -350,7 +350,7 @@ def validate_configuration(env_vars: dict) -> dict:
|
||||
results["domain"] = {
|
||||
"status": "warning",
|
||||
"message": "Using default domain",
|
||||
"items": ["Set PLATFORM_DOMAIN for your deployment"]
|
||||
"items": ["Set MAIN_DOMAIN for your deployment"]
|
||||
}
|
||||
|
||||
# -------------------------------------------------------------------------
|
||||
|
||||
@@ -1445,7 +1445,7 @@ def print_summary(db: Session):
|
||||
print("\n🏪 Demo Stores:")
|
||||
for store in stores:
|
||||
print(f"\n {store.name} ({store.store_code})")
|
||||
print(f" Subdomain: {store.subdomain}.{settings.platform_domain}")
|
||||
print(f" Subdomain: {store.subdomain}.{settings.main_domain}")
|
||||
|
||||
# Show per-platform custom subdomains
|
||||
from app.modules.tenancy.models import Platform
|
||||
|
||||
@@ -235,19 +235,19 @@ def print_dev_urls(platforms, stores, store_domains, store_platform_map):
|
||||
|
||||
def print_prod_urls(platforms, stores, store_domains):
|
||||
"""Print all production URLs."""
|
||||
platform_domain = settings.platform_domain
|
||||
main_domain = settings.main_domain
|
||||
|
||||
print()
|
||||
print("PRODUCTION URLS")
|
||||
print(f"Platform domain: {platform_domain}")
|
||||
print(f"Platform domain: {main_domain}")
|
||||
print(SEPARATOR)
|
||||
|
||||
# Admin
|
||||
print()
|
||||
print(" ADMIN PANEL")
|
||||
print(f" Login: https://admin.{platform_domain}/admin/login")
|
||||
print(f" Dashboard: https://admin.{platform_domain}/admin/")
|
||||
print(f" API: https://admin.{platform_domain}/api/v1/admin/")
|
||||
print(f" Login: https://admin.{main_domain}/admin/login")
|
||||
print(f" Dashboard: https://admin.{main_domain}/admin/")
|
||||
print(f" API: https://admin.{main_domain}/api/v1/admin/")
|
||||
|
||||
# Platforms
|
||||
print()
|
||||
@@ -259,10 +259,10 @@ def print_prod_urls(platforms, stores, store_domains):
|
||||
print(f" Home: https://{p.domain}/")
|
||||
elif p.code == "main":
|
||||
print(f" {p.name}{tag}")
|
||||
print(f" Home: https://{platform_domain}/")
|
||||
print(f" Home: https://{main_domain}/")
|
||||
else:
|
||||
print(f" {p.name} ({p.code}){tag}")
|
||||
print(f" Home: https://{p.code}.{platform_domain}/")
|
||||
print(f" Home: https://{p.code}.{main_domain}/")
|
||||
|
||||
# Group domains by store
|
||||
domains_by_store = {}
|
||||
@@ -280,7 +280,7 @@ def print_prod_urls(platforms, stores, store_domains):
|
||||
|
||||
tag = f" [{status_badge(v.is_active)}]" if not v.is_active else ""
|
||||
print(f" {v.name} ({v.store_code}){tag}")
|
||||
print(f" Dashboard: https://{v.subdomain}.{platform_domain}/store/{v.store_code}/")
|
||||
print(f" Dashboard: https://{v.subdomain}.{main_domain}/store/{v.store_code}/")
|
||||
|
||||
# Storefronts
|
||||
print()
|
||||
@@ -295,7 +295,7 @@ def print_prod_urls(platforms, stores, store_domains):
|
||||
print(f" {v.name} ({v.store_code}){tag}")
|
||||
|
||||
# Subdomain URL
|
||||
print(f" Subdomain: https://{v.subdomain}.{platform_domain}/")
|
||||
print(f" Subdomain: https://{v.subdomain}.{main_domain}/")
|
||||
|
||||
# Custom domains
|
||||
vd_list = domains_by_store.get(v.id, [])
|
||||
|
||||
@@ -63,7 +63,7 @@ if [ "$MODE" = "dev" ]; then
|
||||
fail ".env file not found — copy from .env.example"
|
||||
fi
|
||||
|
||||
REQUIRED_KEYS="DATABASE_URL REDIS_URL JWT_SECRET_KEY ADMIN_EMAIL PLATFORM_DOMAIN"
|
||||
REQUIRED_KEYS="DATABASE_URL REDIS_URL JWT_SECRET_KEY ADMIN_EMAIL MAIN_DOMAIN"
|
||||
for key in $REQUIRED_KEYS; do
|
||||
val=$(env_val "$key")
|
||||
if [ -n "$val" ]; then
|
||||
|
||||
Reference in New Issue
Block a user