Edwin Salguero
commited on
Commit
·
82f45f2
1
Parent(s):
b2fb4a4
Wire up FRED_API_AVAILABLE to flip to True when valid key is detected in load_config()
Browse files- frontend/app.py +4 -1
frontend/app.py
CHANGED
|
@@ -85,7 +85,7 @@ def load_fred_client():
|
|
| 85 |
# Lazy import configuration
|
| 86 |
def load_config():
|
| 87 |
"""Load configuration only when needed"""
|
| 88 |
-
global CONFIG_AVAILABLE, FRED_API_KEY, REAL_DATA_MODE
|
| 89 |
|
| 90 |
# Try multiple sources for FRED API key
|
| 91 |
fred_key = os.getenv('FRED_API_KEY')
|
|
@@ -103,8 +103,11 @@ def load_config():
|
|
| 103 |
# Update global variables
|
| 104 |
FRED_API_KEY = fred_key or ''
|
| 105 |
REAL_DATA_MODE = FRED_API_KEY and FRED_API_KEY != 'your-fred-api-key-here'
|
|
|
|
|
|
|
| 106 |
print(f"DEBUG: load_config() - Updated FRED_API_KEY = {FRED_API_KEY}")
|
| 107 |
print(f"DEBUG: load_config() - Updated REAL_DATA_MODE = {REAL_DATA_MODE}")
|
|
|
|
| 108 |
|
| 109 |
try:
|
| 110 |
from config import Config
|
|
|
|
| 85 |
# Lazy import configuration
|
| 86 |
def load_config():
|
| 87 |
"""Load configuration only when needed"""
|
| 88 |
+
global CONFIG_AVAILABLE, FRED_API_KEY, REAL_DATA_MODE, FRED_API_AVAILABLE
|
| 89 |
|
| 90 |
# Try multiple sources for FRED API key
|
| 91 |
fred_key = os.getenv('FRED_API_KEY')
|
|
|
|
| 103 |
# Update global variables
|
| 104 |
FRED_API_KEY = fred_key or ''
|
| 105 |
REAL_DATA_MODE = FRED_API_KEY and FRED_API_KEY != 'your-fred-api-key-here'
|
| 106 |
+
# Now that we know the key exists, mark the API client as available
|
| 107 |
+
FRED_API_AVAILABLE = bool(REAL_DATA_MODE)
|
| 108 |
print(f"DEBUG: load_config() - Updated FRED_API_KEY = {FRED_API_KEY}")
|
| 109 |
print(f"DEBUG: load_config() - Updated REAL_DATA_MODE = {REAL_DATA_MODE}")
|
| 110 |
+
print(f"DEBUG: load_config() - Updated FRED_API_AVAILABLE = {FRED_API_AVAILABLE}")
|
| 111 |
|
| 112 |
try:
|
| 113 |
from config import Config
|