TL;DR - if config has perms for only one account id / zone id, fill it in automatically on generate/init
zone_id or route, just account_id and script_nameWe have all the ingredients to infer the account_id and zone_id instead of requiring the user to configure it manually using https://api.cloudflare.com/#zone-properties and https://api.cloudflare.com/#accounts-list-accounts.
Open questions:
Made this WIP while we define those open questions
This is a nice to have feature that we could implement for any single account profiles. Cloudflare allows a single profile to be associated with multiple accounts (or collections of zones), so inferring account id only works for profiles with a single account. The same goes for zone id - there can be multiple zone ids per account so you could only infer them if an account had a single associated zone. If I had to guess, the majority of folks using Wrangler would benefit from this.
i think this should be pretty easy to do with the work that's already been done for whoami. if the user already has their config set when we go to generate a manifest, we can request the relevant account id; if there is exactly one we will fill it in, else we can message next steps.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
@xortive Would wrangler login make this outdated?
@Electroid i actually think we can make this better with wrangler login. once you're logged in, when you wrangler init or wrangler generate a project we could let you pick an account and then zone interactively and prefill it for you in wrangler.toml
Most helpful comment
@Electroid i actually think we can make this better with
wrangler login. once you're logged in, when youwrangler initorwrangler generatea project we could let you pick an account and then zone interactively and prefill it for you inwrangler.toml