ethersphere / gateway-proxy

Proxy service for the Bee client
BSD 3-Clause "New" or "Revised" License
11 stars 5 forks source link

support for proxying multiple BEE_API_URLs #501

Open rampall opened 3 months ago

rampall commented 3 months ago
Cafe137 commented 2 months ago

config.ts

  1. const beeApiUrl = BEE_API_URL || DEFAULT_BEE_API_URL split by comma and pluralise

proxy.ts

  1. Change interface Options, replace beeApiUrl: string with string[]
  2. Pick one in beeApiUrl in fetchAndRespond

stamps.ts

  1. Rewrite get postageStamp(): string with custom logic to select stamp (or ignore if using custom middleware for stamps)
Cafe137 commented 2 months ago

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.