Skip to content

REF-18: extract shared requireGoogleApiKey into googleEnvUtils #375

@philniko

Description

@philniko

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.

Metadata

Metadata

Assignees

Labels

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions