Add service CDN management commands#982
Merged
Merged
Conversation
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 a top-level
railway cdncommand for service CDN cache management with dashboard parity through Railway's public GraphQL API.All commands support the standard service selectors and JSON output:
Commands
railway cdn statusShows the current CDN state for the selected service, including:
railway cdn enableEnables CDN caching for the selected service.
Requires an applied public domain. If no domain is available, the command explains that CDN caching can't be enabled until a domain is added.
Uses the dashboard/default CDN settings, then reads back and displays the updated status.
railway cdn disableDisables CDN caching for the selected service.
This does not prompt for confirmation, matching the dashboard toggle behavior. After disabling, it reads back and displays the updated status.
railway cdn updateUpdates CDN caching settings for a service that already has CDN enabled.
Requires at least one setting flag:
The command preserves existing settings that were not changed, then displays the updated status.
railway cdn purge <html|all>Purges CDN cache for the selected service.
Supported scopes:
html: purge HTML cache onlyall: purge the full CDN cacheAPI
Uses only Railway public GraphQL API operations:
serviceInstance { edgeConfig { ... } }enableServiceCdndisableServiceCdnupdateServiceEdgeConfigpurgeServiceCacheJSON output
JSON output includes service and environment context, CDN availability, enabled state, dashboard-facing caching settings, purge watermarks, and warnings.
Tests
Added coverage for:
--json--swr/--no-swrconflictsupdaterequiring at least one setting flagrailway cdn purge <html|all>Validated with:
cargo fmt --check git diff --check cargo check cargo test