From 02c23d730577d33c9c28f4a090f9398338868de2 Mon Sep 17 00:00:00 2001 From: srwadleigh <7832+srwadleigh@users.noreply.github.com> Date: Sun, 11 Apr 2021 18:56:52 +0000 Subject: [PATCH] add ETHERSCAN_API_URL env to allow customizing the api endpoint per network --- .env.example | 2 +- README.md | 1 + src/etherscan.js | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.env.example b/.env.example index c161cc3..4474de6 100644 --- a/.env.example +++ b/.env.example @@ -1,6 +1,6 @@ SERVER_PORT=3000 SERVER_HOST=127.0.0.1 - +ETHERSCAN_API_URL="https://api.etherscan.io" ETHERSCAN_API_KEY= # DB Statediff diff --git a/README.md b/README.md index eb6513a..cd2b129 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,7 @@ And then open in browser `http://172.17.0.2:3000/metrics` ``` docker run \ -e SERVER_HOST=0.0.0.0 \ + -e ETHERSCAN_API_KEY="https://api.etherscan.io" \ -e ETHERSCAN_API_KEY=*** \ -e STATEDIFF_PG_HOST=*** \ -d vulcanize/eth-state-metrics diff --git a/src/etherscan.js b/src/etherscan.js index 075b9d2..3a8239b 100644 --- a/src/etherscan.js +++ b/src/etherscan.js @@ -2,7 +2,7 @@ const axios = require('axios'); const AppError = require('./error'); const etherscanClient = axios.create({ - baseURL: 'https://api.etherscan.io', + baseURL: process.env.ETHERSCAN_API_URL, });