Files
Reklamator/app/routes
gurixandClaude 51d1740bc0 Fix configuration architecture: Add dotenv loading and use app.config consistently
Address architectural inconsistency where environment variables were used
directly instead of through Flask's configuration system.

Issues Fixed:
1. .env file was never loaded - load_dotenv() was missing
2. Routes used os.getenv() directly instead of app.config
3. ANTHROPIC_API_KEY was defined in config but not used properly

Changes:
- config/development.py: Added load_dotenv() at module level
- app/routes/submission.py: Changed os.getenv() to current_app.config.get()
- app/routes/dashboard.py: Changed os.getenv() to current_app.config.get()

Benefits:
- Proper separation of concerns (config vs code)
- .env files now work as expected in development
- Easier to test (can mock app.config)
- Consistent with Flask best practices
- Production env vars still work (no dotenv in production config)

Configuration Flow:
Development: .env → load_dotenv() → os.environ → DevelopmentConfig → app.config
Production:  System env vars → os.environ → ProductionConfig → app.config
Application: app.config.get('ANTHROPIC_API_KEY')

All 49 tests passing (1 skipped)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-17 09:45:31 +02:00
..