Allow overriding Erigons's rpcdaemon URL fixes#8

This commit is contained in:
Willian Mitsuda 2021-07-04 01:54:03 -03:00
parent 5ed8b96061
commit dbde5c6aef
2 changed files with 10 additions and 1 deletions

View File

@ -121,6 +121,14 @@ npm install
npm run build 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=<rpcdaemon-url>
```
### Run it from the source ### Run it from the source
First, a brief explanation about the app: First, a brief explanation about the app:

View File

@ -1,6 +1,7 @@
import { ethers } from "ethers"; 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( export const provider = new ethers.providers.JsonRpcProvider(
ERIGON_NODE, ERIGON_NODE,