diff --git a/app/routes/dashboard.py b/app/routes/dashboard.py index 2492665..cb46cf4 100644 --- a/app/routes/dashboard.py +++ b/app/routes/dashboard.py @@ -248,11 +248,11 @@ def trigger_analysis(feedback_id): actual_product_id, feedback_id, 'analyzing' ) - # Get API key from environment - api_key = os.getenv('ANTHROPIC_API_KEY') + # Get API key from app configuration + api_key = current_app.config.get('ANTHROPIC_API_KEY') if not api_key: - raise Exception("ANTHROPIC_API_KEY not configured") + raise Exception("ANTHROPIC_API_KEY not configured in app settings") # Initialize analyzer analyzer = ClaudeAnalyzer(api_key=api_key) diff --git a/app/routes/submission.py b/app/routes/submission.py index 03df5b9..93a14b0 100644 --- a/app/routes/submission.py +++ b/app/routes/submission.py @@ -146,11 +146,11 @@ def _analyze_feedback_background(app, product_id, feedback_id, feedback_text, ta product_id, feedback_id, 'analyzing' ) - # Get API key from environment - api_key = os.getenv('ANTHROPIC_API_KEY') + # Get API key from app configuration + api_key = current_app.config.get('ANTHROPIC_API_KEY') if not api_key: - raise Exception("ANTHROPIC_API_KEY not configured") + raise Exception("ANTHROPIC_API_KEY not configured in app settings") # Initialize analyzer analyzer = ClaudeAnalyzer(api_key=api_key) diff --git a/config/development.py b/config/development.py index 64d4ec7..ccb8dec 100644 --- a/config/development.py +++ b/config/development.py @@ -1,5 +1,9 @@ """Development configuration""" import os +from dotenv import load_dotenv + +# Load .env file for development +load_dotenv() class DevelopmentConfig: """Development environment configuration"""