fix(platform): make commercial runtime seed docker-safe

Allow the seed script to run from the mounted core-service app path used in deployment containers.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Mortezakoohjani 2026-07-29 11:25:53 +03:30
parent 0d424c500a
commit ea5fabaa7c

View File

@ -10,9 +10,11 @@ import yaml
from sqlalchemy import select from sqlalchemy import select
from sqlalchemy.ext.asyncio import AsyncSession, async_sessionmaker, create_async_engine from sqlalchemy.ext.asyncio import AsyncSession, async_sessionmaker, create_async_engine
# Allow running from repo root or core-service dir # Allow running from the repo checkout or from the mounted /app directory in Docker.
ROOT = Path(__file__).resolve().parents[3] SCRIPT_PATH = Path(__file__).resolve()
sys.path.insert(0, str(Path(__file__).resolve().parents[1])) CORE_SERVICE_ROOT = SCRIPT_PATH.parents[1]
ROOT = next((parent for parent in SCRIPT_PATH.parents if (parent / "docs").exists()), CORE_SERVICE_ROOT)
sys.path.insert(0, str(CORE_SERVICE_ROOT))
from app.commercial.kinds import BUILTIN_REGISTRY_KINDS from app.commercial.kinds import BUILTIN_REGISTRY_KINDS
from app.commercial.service import CommercialRegistryService from app.commercial.service import CommercialRegistryService