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

@@ -21,11 +21,11 @@ Example:
"""
import logging
import os
from collections import defaultdict
from typing import Optional
from providers.shared import ProviderType
from utils.env import get_env
logger = logging.getLogger(__name__)
@@ -65,7 +65,7 @@ class ModelRestrictionService:
def _load_from_env(self) -> None:
"""Load restrictions from environment variables."""
for provider_type, env_var in self.ENV_VARS.items():
env_value = os.getenv(env_var)
env_value = get_env(env_var)
if env_value is None or env_value == "":
# Not set or empty - no restrictions (allow all models)