forked from keep-network/keep-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
79 lines (66 loc) · 1.56 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
package main
import (
"os"
"fmt"
"path"
"time"
"github.com/ipfs/go-log"
"github.com/keep-network/keep-common/pkg/logging"
"github.com/keep-network/keep-core/cmd"
"github.com/urfave/cli"
)
const defaultConfigPath = "./config.toml"
var (
version string
revision string
configPath string
logger = log.Logger("keep-main")
)
func main() {
if version == "" {
version = "unknown"
}
if revision == "" {
revision = "unknown"
}
err := logging.Configure(os.Getenv("LOG_LEVEL"))
if err != nil {
fmt.Fprintf(os.Stderr, "failed to configure logging: [%v]\n", err)
}
app := cli.NewApp()
app.Name = path.Base(os.Args[0])
app.Usage = "CLI for The Keep Network"
app.Description = "Command line interface (CLI) for running a Keep provider"
app.Compiled = time.Now()
app.Authors = []cli.Author{
{
Name: "Keep Network",
Email: "[email protected]",
},
}
app.Version = fmt.Sprintf("%s (revision %s)", version, revision)
app.Flags = []cli.Flag{
cli.StringFlag{
Name: "config,c",
Value: defaultConfigPath,
Destination: &configPath,
Usage: "full path to the configuration file",
},
}
app.Commands = []cli.Command{
cmd.StartCommand,
cmd.RelayCommand,
cmd.PingCommand,
cmd.EthereumCommand,
}
cli.AppHelpTemplate = fmt.Sprintf(`%s
ENVIRONMENT VARIABLES:
KEEP_ETHEREUM_PASSWORD keep client password
LOG_LEVEL space-delimited set of log level directives; set to
"help" for help
`, cli.AppHelpTemplate)
err = app.Run(os.Args)
if err != nil {
logger.Fatal(err)
}
}