From dbde5c6aef7b1e8aaf94a9f9434765598aa98e76 Mon Sep 17 00:00:00 2001 From: Willian Mitsuda Date: Sun, 4 Jul 2021 01:54:03 -0300 Subject: [PATCH] Allow overriding Erigons's rpcdaemon URL fixes#8 --- README.md | 8 ++++++++ src/ethersconfig.ts | 3 ++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 64b0e78..b0b0429 100644 --- a/README.md +++ b/README.md @@ -121,6 +121,14 @@ npm install npm run build ``` +By default, it assumes your Erigon `rpcdaemon` processs is serving requests at http://127.0.0.1:8545. You can customize this URL by specifying the `REACT_APP_ERIGON_URL` environment variable at build time (it needs to be done at build time because the build process generates a static website). + +To do that, export the variable before running `npm run build`: + +``` +export REACT_APP_ERIGON_URL= +``` + ### Run it from the source First, a brief explanation about the app: diff --git a/src/ethersconfig.ts b/src/ethersconfig.ts index 6b24d6d..a7a98a1 100644 --- a/src/ethersconfig.ts +++ b/src/ethersconfig.ts @@ -1,6 +1,7 @@ import { ethers } from "ethers"; -export const ERIGON_NODE = "http://127.0.0.1:8545"; +export const ERIGON_NODE = + process.env.REACT_APP_ERIGON_URL || "http://127.0.0.1:8545"; export const provider = new ethers.providers.JsonRpcProvider( ERIGON_NODE,