2020-09-05 16:07:27 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"os"
|
|
|
|
|
2022-01-20 07:34:50 +00:00
|
|
|
erigonapp "github.com/ledgerwatch/erigon/turbo/app"
|
2021-05-26 10:35:39 +00:00
|
|
|
erigoncli "github.com/ledgerwatch/erigon/turbo/cli"
|
2020-09-05 16:07:27 +00:00
|
|
|
|
|
|
|
"github.com/urfave/cli"
|
|
|
|
)
|
|
|
|
|
2020-09-21 14:10:25 +00:00
|
|
|
// defining a custom command-line flag, a string
|
2020-09-05 16:07:27 +00:00
|
|
|
var flag = cli.StringFlag{
|
|
|
|
Name: "custom-stage-greeting",
|
|
|
|
Value: "default-value",
|
|
|
|
}
|
|
|
|
|
2020-09-21 14:10:25 +00:00
|
|
|
// defining a custom bucket name
|
2020-09-06 15:33:05 +00:00
|
|
|
const (
|
2021-07-04 07:50:32 +00:00
|
|
|
customBucketName = "ch.torquem.demo.tgcustom.CUSTOM_BUCKET" //nolint
|
2020-09-06 15:33:05 +00:00
|
|
|
)
|
|
|
|
|
2020-09-21 14:10:25 +00:00
|
|
|
// the regular main function
|
2020-09-05 16:07:27 +00:00
|
|
|
func main() {
|
2021-05-26 10:35:39 +00:00
|
|
|
// initializing Erigon application here and providing our custom flag
|
2022-01-20 07:34:50 +00:00
|
|
|
app := erigonapp.MakeApp(runErigon,
|
2021-05-26 10:35:39 +00:00
|
|
|
append(erigoncli.DefaultFlags, flag), // always use DefaultFlags, but add a new one in the end.
|
2020-09-21 14:10:25 +00:00
|
|
|
)
|
2020-09-05 16:07:27 +00:00
|
|
|
if err := app.Run(os.Args); err != nil {
|
|
|
|
fmt.Fprintln(os.Stderr, err)
|
|
|
|
os.Exit(1)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-05-26 10:35:39 +00:00
|
|
|
// Erigon main function
|
|
|
|
func runErigon(ctx *cli.Context) {
|
2020-09-21 14:10:25 +00:00
|
|
|
// running a node and initializing a custom bucket with all default settings
|
2021-07-04 07:50:32 +00:00
|
|
|
//eri := node.New(ctx, node.Params{
|
|
|
|
// CustomBuckets: map[string]dbutils.BucketConfigItem{
|
|
|
|
// customBucketName: {},
|
|
|
|
// },
|
|
|
|
//})
|
2020-09-06 15:33:05 +00:00
|
|
|
|
2021-07-04 07:50:32 +00:00
|
|
|
//err := eri.Serve()
|
2020-09-05 16:07:27 +00:00
|
|
|
|
2021-07-04 07:50:32 +00:00
|
|
|
//if err != nil {
|
|
|
|
// log.Error("error while serving a Erigon node", "err", err)
|
|
|
|
//}
|
2020-09-05 16:07:27 +00:00
|
|
|
}
|