feat(config): add APP_BASE_URL setting for outbound link construction
Some checks failed
CI / ruff (push) Successful in 15s
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 been cancelled

Adds app_base_url config (default http://localhost:8000) used for all
outbound URLs: invitation emails, billing checkout redirects, signup
login links, portal return URLs.

Replaces hardcoded https://{main_domain} and localhost:8000 patterns.
Configurable per environment via APP_BASE_URL env var:
- Dev: http://localhost:8000 (or http://acme.localhost:9999)
- Prod: https://wizard.lu

main_domain is preserved for subdomain resolution and cookie config.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-29 21:43:36 +02:00
parent 2a15c14ee8
commit 0d1007282a
6 changed files with 16 additions and 15 deletions

View File

@@ -981,19 +981,10 @@ class StoreTeamService:
):
"""Send team invitation email."""
from app.core.config import settings as app_settings
from app.core.environment import is_production
from app.modules.messaging.services.email_service import EmailService
# Build acceptance URL
# Prod: https://{subdomain}.{main_domain}/invitation/accept?token=...
# Dev: http://localhost:8000/store/{store_code}/invitation/accept?token=...
main_domain = app_settings.main_domain.rstrip("/")
if is_production():
base_url = f"https://{store.subdomain}.{main_domain}"
else:
base_url = f"http://localhost:8000/store/{store.store_code}"
acceptance_link = f"{base_url}/invitation/accept?token={token}"
base_url = app_settings.app_base_url.rstrip("/")
acceptance_link = f"{base_url}/store/{store.store_code}/invitation/accept?token={token}"
email_service = EmailService(db)
email_service.send_template(