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:
10
config.py
10
config.py
@@ -8,7 +8,7 @@ constants used throughout the application.
|
||||
Configuration values can be overridden by environment variables where appropriate.
|
||||
"""
|
||||
|
||||
import os
|
||||
from utils.env import get_env
|
||||
|
||||
# Version and metadata
|
||||
# These values are used in server responses and for tracking releases
|
||||
@@ -25,7 +25,7 @@ __author__ = "Fahad Gilani"
|
||||
# This should be a stable, high-performance model suitable for code analysis
|
||||
# Can be overridden by setting DEFAULT_MODEL environment variable
|
||||
# Special value "auto" means Claude should pick the best model for each task
|
||||
DEFAULT_MODEL = os.getenv("DEFAULT_MODEL", "auto")
|
||||
DEFAULT_MODEL = get_env("DEFAULT_MODEL", "auto") or "auto"
|
||||
|
||||
# Auto mode detection - when DEFAULT_MODEL is "auto", Claude picks the model
|
||||
IS_AUTO_MODE = DEFAULT_MODEL.lower() == "auto"
|
||||
@@ -61,7 +61,7 @@ TEMPERATURE_CREATIVE = 0.7 # For architecture, deep thinking
|
||||
# Thinking Mode Defaults
|
||||
# DEFAULT_THINKING_MODE_THINKDEEP: Default thinking depth for extended reasoning tool
|
||||
# Higher modes use more computational budget but provide deeper analysis
|
||||
DEFAULT_THINKING_MODE_THINKDEEP = os.getenv("DEFAULT_THINKING_MODE_THINKDEEP", "high")
|
||||
DEFAULT_THINKING_MODE_THINKDEEP = get_env("DEFAULT_THINKING_MODE_THINKDEEP", "high") or "high"
|
||||
|
||||
# Consensus Tool Defaults
|
||||
# Consensus timeout and rate limiting settings
|
||||
@@ -117,7 +117,7 @@ def _calculate_mcp_prompt_limit() -> int:
|
||||
Maximum character count for user input prompts
|
||||
"""
|
||||
# Check for Claude's MAX_MCP_OUTPUT_TOKENS environment variable
|
||||
max_tokens_str = os.getenv("MAX_MCP_OUTPUT_TOKENS")
|
||||
max_tokens_str = get_env("MAX_MCP_OUTPUT_TOKENS")
|
||||
|
||||
if max_tokens_str:
|
||||
try:
|
||||
@@ -143,7 +143,7 @@ MCP_PROMPT_SIZE_LIMIT = _calculate_mcp_prompt_limit()
|
||||
# Examples: "fr-FR", "en-US", "zh-CN", "zh-TW", "ja-JP", "ko-KR", "es-ES",
|
||||
# "de-DE", "it-IT", "pt-PT"
|
||||
# Leave empty for default language (English)
|
||||
LOCALE = os.getenv("LOCALE", "")
|
||||
LOCALE = get_env("LOCALE", "") or ""
|
||||
|
||||
# Threading configuration
|
||||
# Simple in-memory conversation threading for stateless MCP environment
|
||||
|
||||
Reference in New Issue
Block a user