fix(config): Ensure API keys are loaded by orchestrator

- Reverts docker-compose.yml to use volume mount for gemini_api_key.txt, due to format constraints.
- Restores and refines Config.load_api_keys() in config.py.
- **Crucially, calls Config.load_api_keys() at the start of gtm_architect_orchestrator.py to ensure keys are loaded.**
- Adjusts _get_gemini_api_key in helpers.py to prioritize keys from Config.API_KEYS.
- This definitively addresses the 'API Key missing' error by guaranteeing key initialization.
This commit is contained in:
2026-01-03 09:33:33 +00:00
parent 8c31a4f2b9
commit 571e05ed51
4 changed files with 44 additions and 18 deletions

View File

@@ -15,6 +15,7 @@ import gtm_db_manager as db_manager
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
from helpers import call_gemini_flash, scrape_website_details
from config import Config, BASE_DIR # Import Config and BASE_DIR
LOG_DIR = "Log_from_docker"
if not os.path.exists(LOG_DIR):
@@ -33,6 +34,10 @@ logging.basicConfig(
]
)
logging.info(f"GTM Architect Orchestrator v{{ORCHESTRATOR_VERSION}} ({{run_timestamp}}) starting...")
# !!! CRITICAL FIX: Load API keys at the very beginning !!!
# This ensures Config.API_KEYS is populated before any AI functions are called.
Config.load_api_keys()
def log_and_save(project_id, step_name, data_type, content):
logging.info(f"Project {project_id} - Step: {step_name} - Type: {data_type}")
filename = f"{run_timestamp}_{step_name}_{data_type}.txt"