feat(settings): add optional Open-Meteo commercial API key#8
Merged
Conversation
A key entered in Settings is stored in localStorage and routes every open-meteo request (forecast, single-runs, archive, geocoding) through the paid customer-*.open-meteo.com hosts with an apikey param; with no key the app stays on the free tier unchanged. The key is wired in as a fetch dependency so toggling it refetches the current view, the service-worker cache routes match the customer hosts too, and a Clear button removes it. Assisted-by: ClaudeCode:claude-opus-4-8
⛅ Preview deploymentThis PR is live at https://preview-b00eed90-meteocompare.frcy.workers.dev Commit |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds an optional Open-Meteo API key field in Settings. When a key is set, every open-meteo request — forecast, single-runs, archive, and geocoding — routes through the paid
customer-*.open-meteo.comcommercial endpoints with anapikeyquery param. With no key, the app stays on the free tier unchanged.buildOpenMeteoUrl()helper (src/api/openMeteo.ts) swaps the host to itscustomer-twin and appends the key; all four API clients route through it.meteocompare:openmeteo:api-key) and is wired as a fetch dependency inuseForecast/useVerification, so toggling it refetches the current view.customer-hosts too.Test plan
npm run lint,npm run type-check,npm test(147 tests) — all green.customer-*.open-meteo.com?...&apikey=...; Clear reverts to the free hosts.🤖 Generated with Claude Code