bee-dashboard icon indicating copy to clipboard operation
bee-dashboard copied to clipboard

Add env. variable to customize default RPC endpoint

Open mfw78 opened this issue 3 years ago • 3 comments

Problem Per #529, it is now not possible to dynamically override constants when building bee-dashboard and forces packagers to apply a diff to src/constants.ts.

Solution Add previously removed support for environment variables (REACT_APP) as alternative defaults for constants to streamline the build process for packagers.

mfw78 avatar Sep 12 '22 03:09 mfw78

So we can't use REACT_APP env. variables directly in the component, because it as dependency it might not be used in context where the CRA's env. replacement is available (and actually is not - in the Swarm Extension, the main reason why we did the refactor).

The solution was to move them into the Dashboard component's props and then reintroduce them for the local build in the index.ts file. During the refactor though I have decided to scope them down only to those that I thought are really needed to be customizable and in case there would be more needed then add them later on.

So can you please tell me what RAECT_APP_* env. variables you use and need to be able to customize?

AuHau avatar Sep 14 '22 10:09 AuHau

Specifically I'm using:

  1. REACT_APP_BEE_HOST
  2. REACT_APP_BEE_DEBUG_HOST
  3. An environment variable to specify a custom default RPC endpoint for Gnosis Chain / Goerli as the case may vary (so, nominally something like REACT_APP_RPC_ENDPOINT).

mfw78 avatar Sep 14 '22 11:09 mfw78

I see, so for the first two, there are still supported env. variables REACT_APP_BEE_API_URL and REACT_APP_BEE_DEBUG_API_URL that should fit your use-case, but indeed there is no way to set the default RPC endpoint. We can fix that 😉

AuHau avatar Sep 14 '22 11:09 AuHau

There is the REACT_APP_DEFAULT_RPC_URL which allows you to override this setting, so closing this ;-)

AuHau avatar Oct 21 '22 07:10 AuHau