Wrangler: WIP RFC: Automatically configure account_id and zone_id

Created on 18 Jul 2019  路  7Comments  路  Source: cloudflare/wrangler

TL;DR - if config has perms for only one account id / zone id, fill it in automatically on generate/init

  • The configured route in wrangler.toml _must_ include a zone name for a zoned publish
  • Zoneless publish don't need a zone_id or route, just account_id and script_name
  • Global config has the global api key and email

We 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:

  • How does this look from a developer experience perspective? when should we fetch these parameters and how should we provide choice between them
  • Is this a good idea?
RFC - accepted login status - PR welcome

Most helpful comment

@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

All 7 comments

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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ispivey picture ispivey  路  4Comments

jahredhope picture jahredhope  路  4Comments

geelen picture geelen  路  5Comments

xtuc picture xtuc  路  5Comments

TownLake picture TownLake  路  3Comments