Edwin Salguero commited on
Commit
6b72109
ยท
1 Parent(s): ec06fe8

Remove pre-flight FRED API key check - rely on REAL_DATA_MODE after load_config()

Browse files
Files changed (1) hide show
  1. frontend/app.py +9 -11
frontend/app.py CHANGED
@@ -425,19 +425,17 @@ def create_forecast_plot(historical_data, forecast_data, title="Forecast"):
425
  def main():
426
  """Main Streamlit application"""
427
 
428
- # Check for FRED API key first
429
- fred_key = os.getenv("FRED_API_KEY") or st.secrets.get("FRED_API_KEY")
430
- if not fred_key:
431
- st.error("โŒ FRED API not available. Please configure your FRED API key.")
 
 
 
 
 
432
  st.info("Get a free FRED API key at: https://fred.stlouisfed.org/docs/api/api_key.html")
433
  st.stop()
434
-
435
- # Show loading indicator
436
- with st.spinner("๐Ÿš€ Initializing FRED ML Platform..."):
437
- # Load configuration
438
- load_config()
439
- load_fred_client()
440
- load_analytics()
441
 
442
  # Force analytics to be available if loading succeeded
443
  if ANALYTICS_AVAILABLE:
 
425
  def main():
426
  """Main Streamlit application"""
427
 
428
+ # Show loading indicator and load everything
429
+ with st.spinner("๐Ÿš€ Initializing FRED ML Platform..."):
430
+ load_config() # pulls from os.environ or st.secrets
431
+ load_fred_client() # sets FRED_API_AVAILABLE
432
+ load_analytics() # sets ANALYTICS_AVAILABLE
433
+
434
+ # Now check whether we're actually in "real data" mode
435
+ if not REAL_DATA_MODE:
436
+ st.error("โŒ FRED API key not configured. Please set FRED_API_KEY environment variable.")
437
  st.info("Get a free FRED API key at: https://fred.stlouisfed.org/docs/api/api_key.html")
438
  st.stop()
 
 
 
 
 
 
 
439
 
440
  # Force analytics to be available if loading succeeded
441
  if ANALYTICS_AVAILABLE: