update go.mod and cmds

This commit is contained in:
Ian Norden
2021-03-10 10:46:21 -06:00
parent 8d10dc98ee
commit f6780ddd95
4 changed files with 10 additions and 15 deletions
+3 -14
View File
@@ -12,7 +12,6 @@ import (
"github.com/spf13/cobra"
"github.com/spf13/viper"
"github.com/vulcanize/gap-filler/pkg/mux"
"github.com/vulcanize/gap-filler/pkg/qlservices"
)
var ErrNoRpcEndpoints = errors.New("no rpc endpoints is available")
@@ -48,22 +47,12 @@ func proxy() {
logWithCommand.Fatal(err)
}
rpcBalancer, err := qlservices.NewBalancer(rpcClients)
if err != nil {
logWithCommand.Fatal(err)
}
tracingClients, err := parseRpcAddresses(viper.GetString("rpc.tracing"))
if err != nil {
logrus.Error("bad rpc.tracing addresses")
logWithCommand.Fatal(err)
}
tracingBalancer, err := qlservices.NewBalancer(tracingClients)
if err != nil {
logWithCommand.Fatal(err)
}
router, err := mux.NewServeMux(&mux.Options{
BasePath: viper.GetString("http.path"),
EnableGraphiQL: viper.GetBool("gql.gui"),
@@ -72,8 +61,8 @@ func proxy() {
TracingAPI: gqlTracingAPIAddr,
},
RPC: mux.RPCOptions{
DefaultBalancer: rpcBalancer,
TracingBalancer: tracingBalancer,
DefaultClients: rpcClients,
TracingClients: tracingClients,
},
})
if err != nil {
@@ -112,7 +101,7 @@ func init() {
// flags
proxyCmd.PersistentFlags().String("http-host", "127.0.0.1", "http host")
proxyCmd.PersistentFlags().String("http-port", "8080", "http port")
proxyCmd.PersistentFlags().String("http-port", "8083", "http port")
proxyCmd.PersistentFlags().String("http-path", "/", "http base path")
proxyCmd.PersistentFlags().String("rpc-eth", "http://127.0.0.1:8545", "comma separated ethereum rpc addresses. Example http://127.0.0.1:8545,http://127.0.0.2:8545")
+2
View File
@@ -138,6 +138,7 @@ func init() {
serveCmd.PersistentFlags().String("eth-default-sender", "", "default sender address")
serveCmd.PersistentFlags().String("eth-rpc-gas-cap", "", "rpc gas cap (for eth_Call execution)")
serveCmd.PersistentFlags().String("eth-chain-config", "", "json chain config file location")
serveCmd.PersistentFlags().Bool("eth-supports-state-diff", false, "whether or not the proxy ethereum client supports statediffing endpoints")
// and their bindings
viper.BindPFlag("server.graphql", serveCmd.PersistentFlags().Lookup("server-graphql"))
@@ -155,4 +156,5 @@ func init() {
viper.BindPFlag("ethereum.defaultSender", serveCmd.PersistentFlags().Lookup("eth-default-sender"))
viper.BindPFlag("ethereum.rpcGasCap", serveCmd.PersistentFlags().Lookup("eth-rpc-gas-cap"))
viper.BindPFlag("ethereum.chainConfig", serveCmd.PersistentFlags().Lookup("eth-chain-config"))
viper.BindPFlag("ethereum.supportsStateDiff", serveCmd.PersistentFlags().Lookup("eth-supports-state-diff"))
}