-
Notifications
You must be signed in to change notification settings - Fork 2.1k
/
main.go
59 lines (50 loc) · 1.53 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
package main
import (
"fmt"
"log"
"os"
"github.com/joho/godotenv"
"github.com/taikoxyz/taiko-mono/packages/blobstorage/api"
"github.com/taikoxyz/taiko-mono/packages/blobstorage/cmd/flags"
"github.com/taikoxyz/taiko-mono/packages/blobstorage/cmd/utils"
"github.com/taikoxyz/taiko-mono/packages/blobstorage/indexer"
"github.com/urfave/cli/v2"
)
func main() {
app := cli.NewApp()
log.SetOutput(os.Stdout)
// attempt to load a .env file to overwrite CLI flags, but allow it to not
// exist.
envFile := os.Getenv("ENV_FILE")
if envFile == "" {
envFile = ".env"
}
_ = godotenv.Load(envFile)
app.Name = "Taiko Blob Catcher"
app.Usage = "The taiko blob catcher softwares command line interface"
app.Copyright = "Copyright 2021-2024 Taiko Labs"
app.Description = "Blob catcher implementation in Golang for Taiko protocol"
app.Authors = []*cli.Author{{Name: "Taiko Labs", Email: "info@taiko.xyz"}}
app.EnableBashCompletion = true
// All supported sub commands.
app.Commands = []*cli.Command{
{
Name: "indexer",
Flags: flags.IndexerFlags,
Usage: "Starts the blobcatcher software",
Description: "Taiko blobcatcher indexer software",
Action: utils.SubcommandAction(new(indexer.Indexer)),
},
{
Name: "server",
Flags: flags.APIFlags,
Usage: "Starts the server software",
Description: "Taiko blobcatcher server software",
Action: utils.SubcommandAction(new(api.API)),
},
}
if err := app.Run(os.Args); err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}
}