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

feat: allow configuring the http_requests via TOML #174

Merged
merged 5 commits into from
Jul 11, 2023

Conversation

Angelmmiguel
Copy link
Contributor

In Wasm Workers Server, we want to follow the capability-based model that Wasm and WASI are enforcing. By default, workers cannot make HTTP requests. To enable it, you need to add a related configuration for the worker and enable only the specific requests you want.

For example:

name = "js-fetch"
version = "1"

[features]
[features.http_requests]
allowed_methods = ["GET"]
allowed_hosts = ["jsonplaceholder.typicode.com"]
allow_http = false

The default values for these config params are:

Param Default value
allowed_methods ["GET", "POST", "PUT", "PATCH", "DELETE"]
allowed_hosts []
allow_http false

It refs #165

@Angelmmiguel Angelmmiguel added the 🚀 enhancement New feature or request label Jul 11, 2023
@Angelmmiguel Angelmmiguel added this to the v1.4.0 milestone Jul 11, 2023
@Angelmmiguel Angelmmiguel requested a review from ereslibre July 11, 2023 08:55
@Angelmmiguel Angelmmiguel self-assigned this Jul 11, 2023
Copy link
Contributor

@ereslibre ereslibre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great! Some comments to have more idiomatic code :)

crates/worker/src/features/http_requests.rs Outdated Show resolved Hide resolved
crates/worker/src/features/http_requests.rs Outdated Show resolved Hide resolved
crates/worker/src/features/http_requests.rs Outdated Show resolved Hide resolved
crates/worker/src/features/http_requests.rs Outdated Show resolved Hide resolved
Copy link
Contributor

@ereslibre ereslibre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great! LGTM 👏

@Angelmmiguel Angelmmiguel merged commit 9b3a217 into main Jul 11, 2023
@Angelmmiguel Angelmmiguel deleted the 165-configure-http branch July 14, 2023 10:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants