-
Notifications
You must be signed in to change notification settings - Fork 4
/
main.go
58 lines (47 loc) · 1.37 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
// It creates a new Echo instance, adds some middleware, creates a new WhyPFS node, creates a new GatewayHandler, and then
// adds a route to the Echo instance
package main
import (
"delta/cmd"
c "delta/config"
_ "embed"
"fmt"
_ "net/http"
"os"
logging "github.com/ipfs/go-log/v2"
"github.com/urfave/cli/v2"
)
var (
log = logging.Logger("delta")
)
var Commit string
var Version string
// It initializes the config, gets all the commands, and runs the app.
func main() {
// get the config
cfg := c.InitConfig()
cfg.Common.Commit = Commit
cfg.Common.Version = Version
// get all the commands
var commands []*cli.Command
// commands
commands = append(commands, cmd.DaemonCmd(&cfg)...)
// cli
commands = append(commands, cmd.CarCmd(&cfg)...)
commands = append(commands, cmd.CommpCmd(&cfg)...)
commands = append(commands, cmd.DealCmd(&cfg)...)
commands = append(commands, cmd.SpCmd(&cfg)...)
commands = append(commands, cmd.StatusCmd(&cfg)...)
commands = append(commands, cmd.WalletCmd(&cfg)...)
app := &cli.App{
Commands: commands,
Name: "delta",
Description: "A deal making engine microservice for the filecoin network",
Version: fmt.Sprintf("%s+git.%s\n", cfg.Common.Version, cfg.Common.Commit),
Flags: cmd.CLIConnectFlags,
Usage: "delta [command] [arguments]",
}
if err := app.Run(os.Args); err != nil {
log.Fatal(err)
}
}