Make watcher API base URL configurable per environment - #127
Merged
Conversation
Replace the hardcoded API_URLS map with per-environment URLs stored in config (`api_base_urls`), so self-hosted deployments point each of staging/production/preview at their own Data Hub without editing source. - WatcherConfig: `api_base_urls` dict + `api_base_url` property, with transparent migration of legacy scalar `api_base_url`/`watcher_id`. - CLI: prompt for the URL on `init` for every environment; switching resolves flag > stored > error and preserves other envs' URLs. - Service/client: require a URL for the active environment and fail loudly when none is configured. - Update docs and tests; bump watcher to 0.5.0. Co-authored-by: Cursor <cursoragent@cursor.com>
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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
Removes the hardcoded
API_URLSmap (which pointed at Arcadia's staging/production deployments) and makes the Data Hub API base URL configurable per environment. Self-hosters can now point each ofstaging/production/previewat their own deployment without editing source. This is a prerequisite for open-sourcing the watcher.models.py): replaces the scalarapi_base_urlfield with anapi_base_urls: dict[str, str]map (one URL per environment) plus anapi_base_urlproperty for the active environment. A pre-validator transparently migrates legacy on-disk configs (scalarapi_base_url/watcher_id) into their per-environment maps. The preview-only URL validator is dropped in favor of enforcing the URL at client-build time.cli.py):initprompts for the API base URL for every environment (no baked-in default). Switching environments resolves the URL as flag > stored > error and preserves every other environment's stored URL.config editdelegates env changes to the switch flow.developer-docs/watcher.mdupdated (init prompt, config example usingapi_base_urls, switching-environments section).data-hub-watcherto0.5.0.Backwards compatibility
Existing configs with a scalar
api_base_url(or none) load transparently via the migration validator; the value is lifted intoapi_base_urlsunder the active environment.Test plan
uv run pytest watcher/tests/— 486 passedmake check-all— ruff, pyright, and web checks greenuv build— producesdata_hub_watcher-0.5.0wheel + sdistdata-hub-watcher init, thenconfig set-environmentround-trips reuse the stored URL without re-promptingMade with Cursor