| import os | |
| import openrouteservice | |
| from dotenv import load_dotenv | |
| load_dotenv() | |
| ORS_API_KEY = os.getenv("ORS_API_KEY") | |
| # Singleton pattern for ORS client | |
| _ors_client = None | |
| def get_ors_client(): | |
| """Get centralized ORS client instance.""" | |
| global _ors_client | |
| if _ors_client is None: | |
| if not ORS_API_KEY: | |
| raise ValueError("ORS_API_KEY not configured in environment") | |
| _ors_client = openrouteservice.Client(key=ORS_API_KEY) | |
| return _ors_client | |
| def is_ors_configured(): | |
| """Check if ORS API key is configured.""" | |
| return ORS_API_KEY is not None |