Migrate API URLs to data.cambeerfestival.app custom domain with relative URL support - #138
Conversation
Co-authored-by: richardthe3rd <573334+richardthe3rd@users.noreply.github.com>
LCOV of commit
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
🚀 Cloudflare Pages PreviewYour preview deployment is ready! Preview URL: https://copilot-update-data-source-u.staging-cambeerfestival.pages.dev This preview will be automatically updated when you push new commits to this PR. |
|
@copilot are there cors related updates we need to make. The screenshots and staging deployment show error loading drinks. |
The error is caused by a deployment sequencing issue:
Solution: When this PR merges to main, the GitHub Actions workflow will automatically redeploy the Cloudflare Worker with the updated The staging/preview deployments are failing because they're fetching from the new domain before the worker has been updated with the new festivals.json data. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
@copilot should festivals.json have relative rather than absolute URLs? Would be more portable? App may need updating? |
Co-authored-by: richardthe3rd <573334+richardthe3rd@users.noreply.github.com>
Good idea! Changed Changes in commit edbbbf4:
This means Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
Co-authored-by: richardthe3rd <573334+richardthe3rd@users.noreply.github.com>
🚀 Cloudflare Pages PreviewYour preview deployment is ready! Preview URL: https://copilot-update-data-source-u.staging-cambeerfestival.pages.dev This preview will be automatically updated when you push new commits to this PR. |
There was a problem hiding this comment.
Pull request overview
This PR successfully migrates the Cambridge Beer Festival app from using the default Cloudflare worker URL (cbf-data-proxy.richard-alcock.workers.dev) to a custom domain (data.cambeerfestival.app), while introducing a flexible relative URL resolution mechanism for festival configurations. This change consolidates CORS configuration under app control and makes the festivals.json configuration file portable across different deployment environments.
Key Changes
- Custom domain migration: All API endpoints now use
data.cambeerfestival.appinstead of the Cloudflare worker default URL - Relative URL support: Festival configurations in
festivals.jsonnow use relative paths (/cbf2025) that are automatically resolved based on where the registry is fetched from - Enhanced portability: The festivals configuration can now be served from any domain without modification, as URLs are resolved dynamically at runtime
Reviewed changes
Copilot reviewed 21 out of 21 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
lib/services/festival_service.dart |
Implements relative URL resolution logic in fromJson factory; extracts base URL from festivals endpoint; adds baseUrl field to FestivalsResponse |
lib/models/festival.dart |
Updates default festival dataBaseUrl values from old Cloudflare worker URL to new custom domain |
data/festivals.json |
Migrates all festival configurations from absolute URLs to relative paths (/cbf2025, /cbfw2025, /cbf2024) |
test/services_test.dart |
Adds baseUrl parameter to all fromJson calls; includes new test case verifying relative URL resolution behavior |
test/models_test.dart |
Updates URL expectations in festival tests to use new custom domain |
test/main_test.dart |
Adds baseUrl parameter to FestivalsResponse constructor in test setup |
test/brewery_screen_test.dart |
Adds baseUrl parameter to test festival response setup |
test/beer_provider_test.dart |
Updates all 10 test cases to include baseUrl parameter in FestivalsResponse constructors |
test-e2e/screenshots.ts |
Updates API_BASE_URL constant from old worker URL to custom domain |
docs/api/festival-registry-schema.json |
Updates $id to new domain; removes format: "uri" constraint; documents relative URL support with updated description and examples |
docs/api/data-api-reference.md |
Updates all API base URL references and example endpoints to use custom domain |
docs/api/beer-list-schema.json |
Updates schema $id to reference new custom domain |
docs/api/README.md |
Updates base URL references and code examples (JavaScript, Python) to use custom domain |
docs/PLAY_STORE_METADATA.md |
Updates API endpoint documentation from old worker URL to custom domain |
docs/NETWORK_ALLOWLIST.md |
Updates domain allowlist entries and example URLs to reference custom domain |
docs/CLOUDFLARE_PAGES_SETUP.md |
Updates worker deployment documentation and verification examples with new domain |
docs/CICD.md |
Updates worker URL references in CI/CD deployment documentation |
cloudflare-worker/README.md |
Updates example URL in code comments to use new custom domain pattern |
README.md |
Updates Data API section with new base URL and example endpoint |
CLAUDE.md |
Updates API details section with new base URL |
.github/copilot-instructions.md |
Updates API section base URL from old worker URL to custom domain |

Replace Cloudflare worker default URLs (
cbf-data-proxy.richard-alcock.workers.dev) with custom domain (data.cambeerfestival.app) to consolidate CORS configuration under app control. Implements relative URL support infestivals.jsonfor improved portability.Changes
Application code:
lib/services/festival_service.dart- festivals registry endpoint, added relative URL resolutionlib/models/festival.dart- default festival data URLsdata/festivals.json- all festival configurations now use relative URLs (/cbf2025instead of absolute URLs)Tests:
test/models_test.dart- URL validation teststest/services_test.dart- added test for relative URL resolution, updated all FestivalsResponse teststest/beer_provider_test.dart- updated provider teststest/main_test.dart- updated main teststest/brewery_screen_test.dart- updated screen teststest-e2e/screenshots.ts- E2E API base constantDocumentation:
docs/api/)$idfieldsdocs/api/festival-registry-schema.json- documented relative URL supportKey Features
Relative URL Support:
festivals.jsonnow uses relative paths (e.g.,/cbf2025) instead of absolute URLs. TheFestivalServiceautomatically resolves these to absolute URLs based on wherefestivals.jsonwas fetched from. This makesfestivals.jsonportable across different domains without requiring modifications.Benefits:
festivals.jsonis served from)festivals.jsoncan be served from any domain without modificationAll 308 tests pass. No breaking changes to existing functionality.
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.