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 files
Files changed (1) hide show
  1. frontend/app.py +1 -4
frontend/app.py CHANGED
@@ -71,13 +71,10 @@ FRED_API_KEY = ''
71
  # Lazy import FRED API client
72
  def load_fred_client():
73
  """Load FRED API client only when needed"""
74
- global FRED_API_AVAILABLE
75
  try:
76
  from frontend.fred_api_client import get_real_economic_data, generate_real_insights
77
- FRED_API_AVAILABLE = True
78
  return True
79
  except ImportError:
80
- FRED_API_AVAILABLE = False
81
  return False
82
 
83
  # Lazy import configuration
@@ -98,7 +95,7 @@ def load_config():
98
  REAL_DATA_MODE = bool(FRED_API_KEY and FRED_API_KEY != "your-fred-api-key-here")
99
  FRED_API_AVAILABLE = REAL_DATA_MODE # ensure downstream checks pass
100
 
101
- print(f"DEBUG load_config ▶ FRED_API_KEY={FRED_API_KEY}, REAL_DATA_MODE={REAL_DATA_MODE}, FRED_API_AVAILABLE={FRED_API_AVAILABLE}")
102
 
103
  # 4) Optionally load additional Config class if you have one
104
  try:
 
71
  # Lazy import FRED API client
72
  def load_fred_client():
73
  """Load FRED API client only when needed"""
 
74
  try:
75
  from frontend.fred_api_client import get_real_economic_data, generate_real_insights
 
76
  return True
77
  except ImportError:
 
78
  return False
79
 
80
  # Lazy import configuration
 
95
  REAL_DATA_MODE = bool(FRED_API_KEY and FRED_API_KEY != "your-fred-api-key-here")
96
  FRED_API_AVAILABLE = REAL_DATA_MODE # ensure downstream checks pass
97
 
98
+ print(f"DEBUG load_config ▶ FRED_API_KEY={FRED_API_KEY!r}, REAL_DATA_MODE={REAL_DATA_MODE}, FRED_API_AVAILABLE={FRED_API_AVAILABLE}")
99
 
100
  # 4) Optionally load additional Config class if you have one
101
  try: