Skip to content

fix: EarthView reads GOOGLE_MAPS_API_KEY first - #149

Open
petercorke wants to merge 1 commit into
mainfrom
fix/earthview-maps-key-env
Open

petercorke wants to merge 1 commit into
mainfrom
fix/earthview-maps-key-env

Conversation

@petercorke

Copy link
Copy Markdown
Owner

Summary

EarthView read its Google Maps key only from GOOGLE_API_KEY, which is also the first name Google's Gemini libraries check. A user with both a Maps key and a Gemini key could only satisfy one of them.

EarthView now checks GOOGLE_MAPS_API_KEY first and falls back to GOOGLE_API_KEY, so existing setups keep working. The docstring explains the lookup order and recommends restricting the key to the Maps Static API and setting a daily quota.

Related issue

Fixes #125

Checklist

  • PR title follows Conventional Commits
  • Tests pass locally: tests/test_image_sources.py -k EarthView, 4 passed against this branch's src
  • Added tests: TestEarthViewKey covers preferred key, fallback, explicit key winning, and no key (no network needed)
  • No new signatures, nothing to type-hint
  • Docstring updated

Not run: the full suite (CI does that). This only touches key lookup in EarthView.__init__ and its docstring, so no behaviour changes other than the new first-choice environment variable.

🤖 Generated with Claude Code

EarthView read its key only from GOOGLE_API_KEY, which is also the first
name Google's Gemini libraries check, so a user with both a Maps key and a
Gemini key could only satisfy one of them. Now GOOGLE_MAPS_API_KEY is
checked first, with GOOGLE_API_KEY kept as a fallback so existing setups
keep working. The docstring explains the lookup order and recommends
restricting the key to the Maps Static API and setting a daily quota.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 7 complexity · 0 duplication

Metric Results
Complexity 7
Duplication 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

EarthView: read key from GOOGLE_MAPS_API_KEY to avoid clash with Gemini's GOOGLE_API_KEY

1 participant