mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2024-12-29 07:07:16 +00:00
1dcc2b141a
* share config object * create default config and logger * move db connection to common func * move server start to cli package * clear * clear * rename cli to rpc * use unified SetupLogger func * make all root flag persistent * use common flags in different packages * use common flags in different packages * move TraceTx method to eth package * use native slice flags * create package "turbo" * disable geth api * disable geth api * move more data types to turbo/adapter package * add support for customApiList * run more * run more * run more * dog-food * move DoCall * move DoCall * fix tests * fix test
31 lines
943 B
Go
31 lines
943 B
Go
package commands
|
|
|
|
import (
|
|
"github.com/ledgerwatch/turbo-geth/cmd/restapi/rest"
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
var (
|
|
rpcAddr string
|
|
chaindata string
|
|
addr string
|
|
)
|
|
|
|
func init() {
|
|
rootCmd.Flags().StringVar(&rpcAddr, "private.api.addr", "127.0.0.1:9090", "binary RPC network address, for example: 127.0.0.1:9090, empty string means not to start the listener. do not expose to public network. serves remote database interface")
|
|
rootCmd.Flags().StringVar(&addr, "http.addr", "127.0.0.1:8080", "REST server listening host")
|
|
rootCmd.Flags().StringVar(&chaindata, "chaindata", "", "path to the database")
|
|
}
|
|
|
|
var rootCmd = &cobra.Command{
|
|
Use: "restapi",
|
|
Short: "restapi exposes read-only blockchain APIs through REST (requires running turbo-geth node)",
|
|
RunE: func(cmd *cobra.Command, args []string) error {
|
|
return rest.ServeREST(cmd.Context(), addr, rpcAddr, chaindata)
|
|
},
|
|
}
|
|
|
|
func RootCommand() *cobra.Command {
|
|
return rootCmd
|
|
}
|