Ekaropolus 0eb2b393f2
All checks were successful
continuous-integration/drone/push Build is passing
SAMI Functionality add
2025-09-16 16:18:45 -06:00

23 lines
620 B
Python

# pxy_routing/services/factory.py
from __future__ import annotations
import os
from functools import lru_cache
from .crowfly_provider import CrowFlyRoutingProvider
from .ors_provider import ORSRoutingProvider
@lru_cache(maxsize=1)
def get_routing_provider():
"""
Select routing provider by env:
ROUTING_PROVIDER = ors | crowfly (default: crowfly)
"""
name = (os.getenv("ROUTING_PROVIDER") or "crowfly").strip().lower()
if name == "ors":
# ORS_* knobs are read inside ORSRoutingProvider
return ORSRoutingProvider()
# Fallback/default
return CrowFlyRoutingProvider()