From 6c7e494dfe6b99d13f2f2465cf5845576948388a Mon Sep 17 00:00:00 2001 From: Eric Hare Date: Fri, 12 Dec 2025 10:42:47 -0800 Subject: [PATCH] Update container_manager.py --- src/tui/managers/container_manager.py | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/tui/managers/container_manager.py b/src/tui/managers/container_manager.py index a319a1ea..3bccd80a 100644 --- a/src/tui/managers/container_manager.py +++ b/src/tui/managers/container_manager.py @@ -114,21 +114,21 @@ class ContainerManager: self._compose_search_log += " ✗ NOT FOUND" # Finally check package resources - self._compose_search_log += "\n 3. Package resources: " + self._compose_search_log += f"\n 3. Package resources: " try: pkg_files = files("tui._assets") self._compose_search_log += f"{pkg_files}" compose_resource = pkg_files / filename if compose_resource.is_file(): - self._compose_search_log += " ✓ FOUND, copying to TUI directory" + self._compose_search_log += f" ✓ FOUND, copying to TUI directory" # Copy to TUI directory tui_path.parent.mkdir(parents=True, exist_ok=True) content = compose_resource.read_text() tui_path.write_text(content) return tui_path else: - self._compose_search_log += " ✗ NOT FOUND" + self._compose_search_log += f" ✗ NOT FOUND" except Exception as e: self._compose_search_log += f" ✗ SKIPPED ({e})" # Don't log this as an error since it's expected when running from source @@ -151,9 +151,17 @@ class ContainerManager: even if os.environ has stale values. """ from dotenv import load_dotenv + from utils.paths import get_tui_env_file env = dict(os.environ) # Start with current environment - env_file = Path(".env") + + # Check centralized TUI .env location first + tui_env_file = get_tui_env_file() + if tui_env_file.exists(): + env_file = tui_env_file + else: + # Fall back to CWD .env for backward compatibility + env_file = Path(".env") if env_file.exists(): try: @@ -162,6 +170,7 @@ class ContainerManager: load_dotenv(dotenv_path=env_file, override=True) # Update our dict with all environment variables (including those from .env) env.update(os.environ) + logger.debug(f"Loaded environment from {env_file}") except Exception as e: logger.debug(f"Error reading .env file for Docker Compose: {e}")