File size: 599 Bytes
e7c5429 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
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 |