diff --git a/local_backend/services/cloud_sync.py b/local_backend/services/cloud_sync.py index 1d3b2fc..b2c6267 100644 --- a/local_backend/services/cloud_sync.py +++ b/local_backend/services/cloud_sync.py @@ -74,8 +74,8 @@ def _latest_activity(db) -> datetime | None: def apply_license(now: datetime | None = None) -> None: """Re-evaluate the license from the stored signed token (no network).""" - if not settings.SITE_ID: - return # dev / unregistered install: licensing off, as before + if not settings.SITE_ID or not settings.CLOUD_URL: + return # dev / unregistered / no cloud configured: licensing off, as before KI-006 from database import SessionLocal from models.business_day import BusinessDay diff --git a/local_backend/services/license.py b/local_backend/services/license.py index 1e62b53..feeb6c0 100644 --- a/local_backend/services/license.py +++ b/local_backend/services/license.py @@ -58,8 +58,11 @@ def parse_dt(value) -> datetime | None: return dt if dt.tzinfo else dt.replace(tzinfo=timezone.utc) -def verify_token(token: str | None, site_id: str, public_key_b64: str = LICENSE_PUBLIC_KEY) -> dict | None: - """Payload of a genuine token for this site, else None.""" +def verify_token(token: str | None, site_id: str, public_key_b64: str | None = None) -> dict | None: + """Payload of a genuine token for this site, else None. The key defaults to + the built-in LICENSE_PUBLIC_KEY (read at call time, so the e2e suite can + swap it in-process for a throwaway test key — never via configuration).""" + public_key_b64 = public_key_b64 or LICENSE_PUBLIC_KEY if not token or "." not in token: return None body, _, sig = token.partition(".")