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

Allow to load a repository file from local filesystem #115

Open
Angelmmiguel opened this issue Mar 16, 2023 · 5 comments
Open

Allow to load a repository file from local filesystem #115

Angelmmiguel opened this issue Mar 16, 2023 · 5 comments
Assignees
Labels
🚀 enhancement New feature or request 👋 good first issue Good for newcomers

Comments

@Angelmmiguel
Copy link
Contributor

Angelmmiguel commented Mar 16, 2023

Is your feature request related to a problem? Please describe.

After adding support for multiple languages in wws 1.0.0, we introduced the concept of the index repository. This toml file contains information about the available language runtimes developers can download.

We constantly release new versions of these runtimes as we add new languages, versions and revisions of the polyfills and wrappers. To test them, you need to point wws to a different location using the WWS_REPO_NAME and WWS_REPO_URL environment variables (or the --repo-name and --repo-url params).

This is not convenient for development / debugging as you need to push changes to a remote place that wws can fetch. These URLs are always remote, as the file:// URL scheme is not allowed.

Describe the solution you'd like

Allow to get the index.toml and related files from the local filesystem. For that, we can check the protocol of the WWS_REPO_URL or --repo-url URL. Note that reqwest doesn't plan to support the file:// scheme as the project focuses on HTTP requests, so we cannot rely on it.

Instead, if we detect the file:// protocol, wws should try to open that file directly using fs::File.

We can detect these URLs and use the File rust library.

Describe alternatives you've considered

Currently, I'm uploading these files to public gists for testing, but it shouldn't be required.

Additional context

No response

@Angelmmiguel Angelmmiguel added 🚀 enhancement New feature or request 👋 good first issue Good for newcomers labels Mar 16, 2023
@carrycooldude
Copy link
Contributor

Will love to work on this issue @Angelmmiguel

@Angelmmiguel
Copy link
Contributor Author

That's amazing @carrycooldude! I'm going to add more details to this issue and how to implement it in wws. Let me assign it to you 😄

@Angelmmiguel
Copy link
Contributor Author

Done @carrycooldude ! Feel free to add any question you may have about this change.

Thank you!

@carrycooldude
Copy link
Contributor

Hey @Angelmmiguel , actually I am not able to understand the problem properly...
can you help me out in this

@Angelmmiguel
Copy link
Contributor Author

Hello @carrycooldude,

About this issue, wws retrieves the information of the available language runtimes from a remote URL. By default, wws accesses to https://workers.wasmlabs.dev/repository/v1/index.toml when running the following command:

$ wws runtimes list

⚙️  Fetching data from the repository...
┌────────┬───────────────────┬──────────────────────┬───────────┬─────────────┐
│ Name   │ Version           │ Tags                 │ Extension │ Binary      │
├────────┼───────────────────┼──────────────────────┼───────────┼─────────────┤
│ ruby   │ 3.2.0+20230215-1  │ latest, 3.2, 3.2.0   │ rb        │ ruby.wasm   │
├────────┼───────────────────┼──────────────────────┼───────────┼─────────────┤
│ python │ 3.11.1+20230217-1 │ latest, 3.11, 3.11.1 │ py        │ python.wasm │
├────────┼───────────────────┼──────────────────────┼───────────┼─────────────┤
│ ruby   │ 3.2.0+20230215    │ -                    │ rb        │ ruby.wasm   │
├────────┼───────────────────┼──────────────────────┼───────────┼─────────────┤
│ python │ 3.11.1+20230217   │ -                    │ py        │ python.wasm │
└────────┴───────────────────┴──────────────────────┴───────────┴─────────────┘

This information is hardcoded on the config crate, but you can force it to access a different URL using the WWS_REPO_NAME and WWS_REPO_URL environment variables or the --repo-name and --repo-url flags. This is useful for using a different repo, create your own one or for testing new versions and languages.

Currently, the repo-url only allows a remote URL. The goal of this issue is to make it more flexible, so you can also point to a local file in the system by providing a file:// URL. This is tremendously useful when debugging a language runtime or adding it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🚀 enhancement New feature or request 👋 good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants