Add new `--bindings` command line argument
See original GitHub issueThis argument is a JSON stringified array of all the bindings that are being passed from Wrangler in the same format as would be uploaded to a Worker during publishing…
For example, if you have the following vars
in wrangler.toml:
[[vars]]
a = "10"
b = 20
c = { value: 30 }
Then we actually create bindings that look like:
[
{ "type": "plain_text", "name": "a", "text": "10" },
{ "type": "json", "name": "b", "json": "20" },
{ "type": "json", "name": "c", "json": "{ \"value\": 30 }" }
]
The same would apply to other binding types such as
- kv_namespace
- wasm_module
- text_blob
- durable_object_namespace
- r2_bucket
It is then up to Miniflare to parse the JSON and work out how to assign the bindings to the appropriate plugins.
This would mean that Wrangler would not need to use the specific keys such as --kv
, --binding
, etc in a backwardly compatible way.
Issue Analytics
- State:
- Created 2 years ago
- Comments:7 (2 by maintainers)
Top Results From Across the Web
How to bind arguments to handlers in System.CommandLine
var rootCommand = new RootCommand("Parameter binding example"); rootCommand.Add(delayOption); rootCommand.Add(messageOption); rootCommand.
Read more >command-line-api/model-binding.md at main - GitHub
This conversion of command line input into variables or arguments that you can use in your code is called "binding." The term "model...
Read more >Best way to swap Guice bindings based on command line ...
I'd suggest first creating an injector that only binds what you need to do the command line processing. Then do the command line...
Read more >Command-Line Arguments | Unreal Engine Documentation
Command -Line Arguments are strings of keywords that you can pass when running the executable via the command line or a shortcut to...
Read more >Command line arguments - win-acme
IIS plugin. [--installation iis]. --installationsiteid Specify site to install new bindings to. Defaults to the source if that is an ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hey everyone! 👋 Just had a chat with @JacobMGEvans and proposed an alternative. Instead of adding a
--bindings
CLI argument to Miniflare, I think Wrangler should be calling Miniflare via its API.Basically instead of using
require.resolve("miniflare/cli")
here… https://github.com/cloudflare/wrangler2/blob/43417469ef071e4f673507ff1dfa11f3bde29428/packages/wrangler/src/dev.tsx#L298 …Wrangler would call its own separate script file that looked something like Miniflare’scli.ts
: https://github.com/cloudflare/miniflare/blob/870b401ef520c1826339ff060fd8a0a576392a91/packages/miniflare/src/cli.ts#L93-L104 It would be up to you to define the options format then, and you could use a stringified JSON array if you wanted. The API is much more amenable to Wrangler’s use case anyways and it already supports arbitrarybindings
:cc @threepointone
Just trying to avoid a major refactor at this point, but if that’s the only option we have, sure I guess.