From ea5fabaa7cd02714076c0256ca89aa7d2267a931 Mon Sep 17 00:00:00 2001 From: Mortezakoohjani Date: Wed, 29 Jul 2026 11:25:53 +0330 Subject: [PATCH] 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 --- backend/core-service/scripts/seed_commercial_runtime.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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