cloudflare / workers-sdk

⛅️ Home to Wrangler, the CLI for Cloudflare Workers®
https://developers.cloudflare.com/workers/
Apache License 2.0
2.58k stars 667 forks source link

chore: consolidate `config` and `args` #1356

Open threepointone opened 2 years ago

threepointone commented 2 years ago

There's a bit of tension in the way we read "configuration" right now.

petebacondarwin commented 2 years ago

💯

JacobMGEvans commented 2 years ago

I think the thing to do here, is field by field, make sure args values are being read and applied into the Config object

I started doing something like this with envName which I think could be a reference for how we could

https://github.com/cloudflare/wrangler2/blob/75f3ae829b0b4f8ae2cf2093bda93e8096838240/packages/wrangler/src/config/validation.ts#L118-L125

mrbbot commented 9 months ago

Hey! 👋 We're hoping to solve a lot of these problems with the current Wrangler-as-a-library work we're doing. Specifically, we're planning to extract configuration handling into an isolated ConfigController component, that handles the merging of config between API options (or CLI flags), and the wrangler.toml file. This will allow us to standardise how we consolidate these options in the next major version. 👍