feat: centralized environment handling, ensures ZEN_MCP_FORCE_ENV_OVERRIDE is honored correctly

fix: updated tests to override env variables they need instead of relying on the current values from .env
This commit is contained in:
Fahad
2025-10-04 14:28:56 +04:00
parent 4015e917ed
commit 2c534ac06e
24 changed files with 300 additions and 179 deletions

View File

@@ -2,10 +2,11 @@
import importlib.resources
import logging
import os
from pathlib import Path
from typing import Optional
from utils.env import get_env
# Import handled via importlib.resources.files() calls directly
from utils.file_utils import read_json_file
@@ -50,7 +51,7 @@ class OpenRouterModelRegistry:
self.config_path = Path(config_path)
else:
# Check environment variable first
env_path = os.getenv("CUSTOM_MODELS_CONFIG_PATH")
env_path = get_env("CUSTOM_MODELS_CONFIG_PATH")
if env_path:
# Environment variable path
self.config_path = Path(env_path)