Skip to content

Make watcher API base URL configurable per environment - #127

Merged
wasimxyz merged 1 commit into
stagingfrom
watcher-per-env-api-urls
Jul 7, 2026
Merged

Make watcher API base URL configurable per environment#127
wasimxyz merged 1 commit into
stagingfrom
watcher-per-env-api-urls

Conversation

@wasimxyz

@wasimxyz wasimxyz commented Jul 7, 2026

Copy link
Copy Markdown
Member

Summary

Removes the hardcoded API_URLS map (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 of staging/production/preview at their own deployment without editing source. This is a prerequisite for open-sourcing the watcher.

  • Model (models.py): replaces the scalar api_base_url field with an api_base_urls: dict[str, str] map (one URL per environment) plus an api_base_url property for the active environment. A pre-validator transparently migrates legacy on-disk configs (scalar api_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 (cli.py): init prompts 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 edit delegates env changes to the switch flow.
  • Service / client: require a URL for the active environment and fail loudly (clear error / exit 1) when none is configured, instead of silently falling back to someone else's server.
  • Docs: developer-docs/watcher.md updated (init prompt, config example using api_base_urls, switching-environments section).
  • Version: bumps data-hub-watcher to 0.5.0.

Backwards compatibility

Existing configs with a scalar api_base_url (or none) load transparently via the migration validator; the value is lifted into api_base_urls under the active environment.

Test plan

  • uv run pytest watcher/tests/ — 486 passed
  • make check-all — ruff, pyright, and web checks green
  • uv build — produces data_hub_watcher-0.5.0 wheel + sdist
  • Manual: data-hub-watcher init, then config set-environment round-trips reuse the stored URL without re-prompting

Made with Cursor

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>
@vercel

vercel Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
data-hub Ready Ready Preview, Comment Jul 7, 2026 9:26pm

Request Review

@wasimxyz wasimxyz self-assigned this Jul 7, 2026
@wasimxyz
wasimxyz merged commit 7ef9352 into staging Jul 7, 2026
4 checks passed
@wasimxyz
wasimxyz deleted the watcher-per-env-api-urls branch July 7, 2026 21:32
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.

1 participant