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:
@@ -1,9 +1,10 @@
|
||||
"""Custom API provider implementation."""
|
||||
|
||||
import logging
|
||||
import os
|
||||
from typing import Optional
|
||||
|
||||
from utils.env import get_env
|
||||
|
||||
from .openai_compatible import OpenAICompatibleProvider
|
||||
from .openrouter_registry import OpenRouterModelRegistry
|
||||
from .shared import ModelCapabilities, ProviderType
|
||||
@@ -56,9 +57,9 @@ class CustomProvider(OpenAICompatibleProvider):
|
||||
"""
|
||||
# Fall back to environment variables only if not provided
|
||||
if not base_url:
|
||||
base_url = os.getenv("CUSTOM_API_URL", "")
|
||||
base_url = get_env("CUSTOM_API_URL", "") or ""
|
||||
if not api_key:
|
||||
api_key = os.getenv("CUSTOM_API_KEY", "")
|
||||
api_key = get_env("CUSTOM_API_KEY", "") or ""
|
||||
|
||||
if not base_url:
|
||||
raise ValueError(
|
||||
|
||||
Reference in New Issue
Block a user