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

support for proxying multiple BEE_API_URLs #1

Open
ferencsarai opened this issue Aug 30, 2024 · 0 comments
Open

support for proxying multiple BEE_API_URLs #1

ferencsarai opened this issue Aug 30, 2024 · 0 comments

Comments

@ferencsarai
Copy link
Member

ferencsarai commented Aug 30, 2024

Copied from: ethersphere#501

  • allow comma separated values for BEE_API_URL
  • cycle requests between those URLs as a simple load balancer
  1. config.ts
    const beeApiUrl = BEE_API_URL || DEFAULT_BEE_API_URL split by comma and pluralise

  2. proxy.ts

    1. Change interface Options, replace beeApiUrl: string with string[]
    2. Pick one in beeApiUrl in fetchAndRespond
  3. stamps.ts
    Rewrite get postageStamp(): string with custom logic to select stamp (or ignore if using custom middleware for stamps)

  4. server.ts
    There is a Bee instance created in server.ts:

    const bee = new Bee(beeApiUrl)

    However, it is used only for readiness checks, exposing Bee identity, and homepage. If you don't need those features, feel free to ignore it.

    Simple but ugly fix is using beeApiUrls[0] instead.

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

No branches or pull requests

1 participant