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

Refactor Bindings to support all binding types #273

Closed
cwndrws opened this issue Jun 26, 2019 · 3 comments · Fixed by #334
Closed

Refactor Bindings to support all binding types #273

cwndrws opened this issue Jun 26, 2019 · 3 comments · Fixed by #334
Assignees
Labels

Comments

@cwndrws
Copy link

cwndrws commented Jun 26, 2019

Wrangler should be able to support all binding types not just wasm and kv. In order to support future bindings and make bindings generation simpler, we should try to treat all bindings the same (kv, wasm, secrets, etc.).

@xtuc
Copy link
Member

xtuc commented Jun 26, 2019

Thanks for your issue; could you please elaborate on why it's not the case already? Also see #217

@cwndrws
Copy link
Author

cwndrws commented Jun 26, 2019

I think #217 is a fine approach, but only adds support for wasm bindings, and there are many other binding types. Right now, kv_namespaces are treated as attributes of a project, but it might make more sense to have a list of bindings as an attribute of project including all wasm modules, KV namespaces, secret bindings, and others. I'm just getting into this code, so I could be off-base, but we currently generate and send bindings at publish time, but I think bindings are a good abstraction to use directly as an attribute of the Project struct. So instead of having a kv_namespaces and whatever future binding types get supported by Wrangler as attributes of a project, their bindings would get generated at Project init (read from config).

@xtuc
Copy link
Member

xtuc commented Jun 27, 2019

The webpack backend currently auto-generate the wasm binding, I don't see why we should ask the user to indicate it and in the future we could imagine the same for kv-namespaces. However, in #215 the kv config is still possible in wrangler.toml.

Other bindings are different and, as far as I can tell, undocumented publicly (intentionally I suppose). I would suggest to wait until we have a use-case.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants