erigon-pulse/cmd/erigoncustom/main.go
2021-07-04 08:50:32 +01:00

50 lines
1.1 KiB
Go

package main
import (
"fmt"
"os"
erigoncli "github.com/ledgerwatch/erigon/turbo/cli"
"github.com/urfave/cli"
)
// defining a custom command-line flag, a string
var flag = cli.StringFlag{
Name: "custom-stage-greeting",
Value: "default-value",
}
// defining a custom bucket name
const (
customBucketName = "ch.torquem.demo.tgcustom.CUSTOM_BUCKET" //nolint
)
// the regular main function
func main() {
// initializing Erigon application here and providing our custom flag
app := erigoncli.MakeApp(runErigon,
append(erigoncli.DefaultFlags, flag), // always use DefaultFlags, but add a new one in the end.
)
if err := app.Run(os.Args); err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}
}
// Erigon main function
func runErigon(ctx *cli.Context) {
// running a node and initializing a custom bucket with all default settings
//eri := node.New(ctx, node.Params{
// CustomBuckets: map[string]dbutils.BucketConfigItem{
// customBucketName: {},
// },
//})
//err := eri.Serve()
//if err != nil {
// log.Error("error while serving a Erigon node", "err", err)
//}
}