Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🚀 Feature Request: Expose readConfig as API for programmatically use #3897

Open
alexanderniebuhr opened this issue Sep 6, 2023 · 2 comments
Labels
enhancement New feature or request start-dev-worker Relating to the startDevWorker API

Comments

@alexanderniebuhr
Copy link
Contributor

alexanderniebuhr commented Sep 6, 2023

Describe the solution

When using Wrangler in combination with other development servers like Astro, it becomes necessary to read the Wrangler configuration programmatically. Currently, there's no straightforward way to do this, which makes integration cumbersome and less efficient.

I propose exposing the readConfig function as a programmatic API. This would allow developers to easily read the Wrangler configuration when using Wrangler programmatically in combination with other tools.

  1. Manually reading and parsing the wrangler.toml file: This is error-prone and doesn't account for any internal logic that Wrangler might use to read its configuration, or any added options.
  2. Using child processes to run Wrangler commands and parse the output: This is inefficient and can lead to various issues related to process management.

This feature would be particularly useful for developers who are using Wrangler in a more complex setup, where multiple development servers or build tools are involved. For example, when using Wrangler with Astro, one could read the Wrangler config to programmatically set up proxying, environment variables, etc.

@sdarnell
Copy link

Also note that it appears there is a move to switch from .toml to .json (Yay! 🥳 ) but when that happens it'll be more complicated and error prone (to support both).

@alexanderniebuhr
Copy link
Contributor Author

Sure, would love to see exposed APIs for json also. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request start-dev-worker Relating to the startDevWorker API
Projects
Status: Backlog
Development

No branches or pull requests

3 participants