Skip to content
This repository has been archived by the owner on Aug 3, 2023. It is now read-only.

Add wrangler zone command #1941

Closed
wants to merge 4 commits into from
Closed

Conversation

jb3
Copy link

@jb3 jb3 commented May 28, 2021

What?

Adds a wrangler zone command to find the ID of a zone straight from the wrangler CLI.

Screenshot 2021-05-28 at 22 36 25

Why?

When generating a new project with wrangler you are directed to the dashboard for the final step to find the Zone ID for the domain you want to add the Worker to. This PR introduces a command which lets you remain in wrangler for the entire creation ➡️ publish to custom route flow.

Caveats

  • I could not find a way to do permission checking. When a token does not have permission the Cloudflare API just returns no entries, to counter this I've added a message when a zone is not found to check spelling but also check wrangler permissions.
  • This may require a change in how tokens are created with wrangler login, they should include the Zone.Zone permission to be able to read zone information.

ToDo

  • Document the new command in the README.md
  • Document the new command in the commands documentation page.
  • Update references in wrangler itself to reference the new zone command instead of directing people to the dashboard (optional, this might not be a good idea if tokens are not retroactively updated, as it will then be a more strenous task than just going to fetch the zone ID).

@jb3 jb3 requested a review from a team as a code owner May 28, 2021 21:44
jb3 added 2 commits May 28, 2021 22:56
Refactors the zones response length check in wrangler zone to an is_empty() call as per the clippy recommendation.
@nilslice nilslice self-requested a review June 1, 2021 15:34
@nilslice nilslice added the feature Feature requests and suggestions label Jun 1, 2021
@Electroid
Copy link
Contributor

Thanks for working on this @jb3, this looks pretty slick! We had a chat about this among the team and while we like it, I think there's a more interesting question at play here: why should we require the zone_id in the first place? There's a simple answer, for now, which is our API requires it; but we could change that :)

In that future world, you would just define the routes and we would figure out which zones (yep, multi-zone support) you want to publish to. If we were to add that new API, does the need for this go away?

@jb3
Copy link
Author

jb3 commented Jun 3, 2021

Very interesting idea! Multi-zone support would be fantastic. 😄

@stale
Copy link

stale bot commented Jan 9, 2022

This issue has been automatically marked as stale because it has not had recent activity in the last 180 days. It will be closed if no further activity occurs in the next week. Please feel free to comment if you'd like it to remain open, and thank you for your contributions.

@stale stale bot added the timed out label Jan 9, 2022
@stale
Copy link

stale bot commented Mar 2, 2022

This issue has been automatically closed because it has not had recent activity. You may re-open the issue if it is still relevant.

@stale stale bot closed this Mar 2, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature Feature requests and suggestions timed out
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants