diff --git a/backend/core-service/scripts/seed_commercial_runtime.py b/backend/core-service/scripts/seed_commercial_runtime.py index ebe553e..06dee42 100644 --- a/backend/core-service/scripts/seed_commercial_runtime.py +++ b/backend/core-service/scripts/seed_commercial_runtime.py @@ -10,9 +10,11 @@ import yaml from sqlalchemy import select from sqlalchemy.ext.asyncio import AsyncSession, async_sessionmaker, create_async_engine -# Allow running from repo root or core-service dir -ROOT = Path(__file__).resolve().parents[3] -sys.path.insert(0, str(Path(__file__).resolve().parents[1])) +# Allow running from the repo checkout or from the mounted /app directory in Docker. +SCRIPT_PATH = Path(__file__).resolve() +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.service import CommercialRegistryService