Skip to content

Commit

Permalink
include support for list of web3 providers on env file and docker-com…
Browse files Browse the repository at this point in the history
…pose.yml
  • Loading branch information
lucasmenendez committed Sep 1, 2023
1 parent 9b85b50 commit 6450e9d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
3 changes: 1 addition & 2 deletions .env
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# A web3 endpoint provider
# WEB3_PROVIDER="https://mainnet.infura.io/v3/..."
WEB3_PROVIDER="https://web3.dappnode.net"
WEB3_PROVIDERS=https://eth.llamarpc.com,https://eth-goerli.api.onfinality.io/public

# Internal port for the service (80 and 443 are used by traefik)
PORT=7788
Expand Down
6 changes: 4 additions & 2 deletions cmd/census3/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"os"
"os/signal"
"strings"
"syscall"
"time"

Expand All @@ -25,7 +26,7 @@ func main() {
logLevel := flag.String("logLevel", "info", "log level (debug, info, warn, error)")
port := flag.Int("port", 7788, "HTTP port for the API")
connectKey := flag.String("connectKey", "", "connect group key for IPFS connect")
web3Providers := flag.StringArray("web3Providers", []string{}, "the list of URL's of available web3 providers")
listOfWeb3Providers := flag.String("web3Providers", "", "the list of URL's of available web3 providers (separated with commas)")
flag.Parse()
log.Init(*logLevel, "stdout", nil)

Expand All @@ -34,7 +35,8 @@ func main() {
log.Fatal(err)
}

w3p, err := state.CheckWeb3Providers(*web3Providers)
web3Providers := strings.Split(*listOfWeb3Providers, ",")
w3p, err := state.CheckWeb3Providers(web3Providers)
if err != nil {
log.Fatal(err)
}
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ services:
volumes:
- census3:/app/data
command:
- "--url=${WEB3_PROVIDER}"
- "--web3Providers=${WEB3_PROVIDERS}"
- "--port=${PORT}"
- "--logLevel=${LOGLEVEL}"
- "--connectKey=${CONNECT_KEY}"
Expand Down

0 comments on commit 6450e9d

Please sign in to comment.