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

Fetch from other workers and internals #200

Open
Angelmmiguel opened this issue Aug 21, 2023 · 0 comments
Open

Fetch from other workers and internals #200

Angelmmiguel opened this issue Aug 21, 2023 · 0 comments
Labels
🚀 enhancement New feature or request

Comments

@Angelmmiguel
Copy link
Contributor

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

The fetch feature allows you to retrieve data from an external service. However, you cannot query other worker in your project. In some cases, you may need to call a different worker to get some information.

Describe the solution you'd like

I want that workers can perform calls other workers. This is useful to retrieve information from another endpoint before sending the data to the client. If we combine this with the ability of defining workers that are not exposed publicly (internal), you have a way to share an API endpoint only for internal usage.

The workers can call others based on the URL path, as they are calling an URL to the same domain (like /fixed or /api/v1/hello). By default, workers cannot call others unless you explicitly enable it via configuration:

name = "fetch"
version = "1"

[features]
[features.fetch]
allowed_domains = ["https://example.com"]
allowed_workers = ["/test"]

You can specify the all keyword to allow query any worker:

name = "fetch"
version = "1"

[features]
[features.fetch]
allowed_domains = ["https://example.com"]
allowed_workers = ["all"]

Internal workers

To define a worker that only other workers can query, use the internal property:

name = "fetch"
version = "1"
internal = true

[features]
[features.fetch]
allowed_domains = ["https://example.com"]

Describe alternatives you've considered

No response

Additional context

No response

@Angelmmiguel Angelmmiguel added the 🚀 enhancement New feature or request label Aug 21, 2023
@ereslibre ereslibre self-assigned this Sep 11, 2023
@ereslibre ereslibre removed their assignment Jan 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🚀 enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants