forked from cerc-io/ipld-eth-server
fix serve command for ipld graphql server
This commit is contained in:
parent
75debec01a
commit
31cbaec567
16
cmd/serve.go
16
cmd/serve.go
@ -164,14 +164,18 @@ func startIpldGraphQL(settings *s.Config) error {
|
||||
return err
|
||||
}
|
||||
|
||||
ethClients, err := parseRpcAddresses(viper.GetString("ethereum.httpPath"))
|
||||
ethClients, err := parseRpcAddresses(settings.EthHttpEndpoint)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
tracingClients, err := parseRpcAddresses(viper.GetString("tracing.httpPath"))
|
||||
if err != nil {
|
||||
return err
|
||||
var tracingClients []*rpc.Client
|
||||
tracingEndpoint := viper.GetString("tracing.httpPath")
|
||||
if tracingEndpoint != "" {
|
||||
tracingClients, err = parseRpcAddresses(tracingEndpoint)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
router, err := mux.NewServeMux(&mux.Options{
|
||||
@ -190,9 +194,7 @@ func startIpldGraphQL(settings *s.Config) error {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := http.ListenAndServe(settings.IpldGraphqlEndpoint, router); err != nil {
|
||||
logWithCommand.Fatal(err)
|
||||
}
|
||||
go http.ListenAndServe(settings.IpldGraphqlEndpoint, router)
|
||||
} else {
|
||||
logWithCommand.Info("IPLD GraphQL server is disabled")
|
||||
}
|
||||
|
@ -79,6 +79,7 @@ type Config struct {
|
||||
ChainConfig *params.ChainConfig
|
||||
DefaultSender *common.Address
|
||||
RPCGasCap *big.Int
|
||||
EthHttpEndpoint string
|
||||
Client *rpc.Client
|
||||
SupportStateDiff bool
|
||||
}
|
||||
@ -97,12 +98,14 @@ func NewConfig() (*Config, error) {
|
||||
c.DBConfig.Init()
|
||||
|
||||
ethHTTP := viper.GetString("ethereum.httpPath")
|
||||
nodeInfo, cli, err := shared.GetEthNodeAndClient(fmt.Sprintf("http://%s", ethHTTP))
|
||||
ethHTTPEndpoint := fmt.Sprintf("http://%s", ethHTTP)
|
||||
nodeInfo, cli, err := shared.GetEthNodeAndClient(ethHTTPEndpoint)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
c.Client = cli
|
||||
c.SupportStateDiff = viper.GetBool("ethereum.supportsStateDiff")
|
||||
c.EthHttpEndpoint = ethHTTPEndpoint
|
||||
|
||||
// websocket server
|
||||
wsEnabled := viper.GetBool("eth.server.ws")
|
||||
|
Loading…
Reference in New Issue
Block a user