Refactor
Extract shared requireGoogleApiKey utility to eliminate duplication across Google services.
What:
- Created services/googleEnvUtils.ts as the single source of truth for requireGoogleApiKey()
- Removed the duplicate implementations from GoogleDirectionsService.ts and GooglePlacesService.ts
- Both services now import from the shared utility
Why:
RequireGoogleApiKey() was independently defined in two service files with slightly diverging error messages, a subtle inconsistency that would grow worse as more Google services are added. Centralizing it ensures any future service uses the same validation logic and error message, and means any future change (e.g. updated error text, logging) only needs to happen in one place.
Refactor
Extract shared requireGoogleApiKey utility to eliminate duplication across Google services.
What:
Why:
RequireGoogleApiKey() was independently defined in two service files with slightly diverging error messages, a subtle inconsistency that would grow worse as more Google services are added. Centralizing it ensures any future service uses the same validation logic and error message, and means any future change (e.g. updated error text, logging) only needs to happen in one place.