Edwin Salguero commited on
Commit ·
1b7a8ef
1
Parent(s): c2c9316
CRITICAL FIX: Stop load_fred_client() from clobbering FRED_API_AVAILABLE flag set in load_config()
Browse files70 unmodified lines7172737474757776778078798014 unmodified lines959697101989910010170 unmodified lines# Lazy import FRED API clientdef load_fred_client(): """Load FRED API client only when needed""" global FRED_API_AVAILABLE try: from frontend.fred_api_client import get_real_economic_data, generate_real_insights FRED_API_AVAILABLE = True return True except ImportError: FRED_API_AVAILABLE = False return False
# Lazy import configuration14 unmodified lines REAL_DATA_MODE = bool(FRED_API_KEY and FRED_API_KEY != "your-fred-api-key-here") FRED_API_AVAILABLE = REAL_DATA_MODE # ensure downstream checks pass
print(f"DEBUG load_config ▶ FRED_API_KEY={FRED_API_KEY}, REAL_DATA_MODE={REAL_DATA_MODE}, FRED_API_AVAILABLE={FRED_API_AVAILABLE}") print(f"DEBUG load_config ▶ FRED_API_KEY={FRED_API_KEY!r}, REAL_DATA_MODE={REAL_DATA_MODE}, FRED_API_AVAILABLE={FRED_API_AVAILABLE}")
# 4) Optionally load additional Config class if you have one try:frontend/app.py+1-4