-
Notifications
You must be signed in to change notification settings - Fork 35
/
main.go
48 lines (41 loc) · 797 Bytes
/
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
package main
import (
"os"
"github.com/codegangsta/cli"
"github.com/ehazlett/stellar/version"
log "github.com/sirupsen/logrus"
)
func main() {
app := cli.NewApp()
app.Name = version.Name + " daemon"
app.Version = version.BuildVersion()
app.Author = "@ehazlett"
app.Email = ""
app.Usage = version.Description
app.Flags = []cli.Flag{
cli.BoolFlag{
Name: "debug, D",
Usage: "Enable debug logging",
},
}
app.Commands = []cli.Command{
serverCommand,
configCommand,
networkCommand,
}
app.Before = func(c *cli.Context) error {
if c.Bool("debug") {
log.SetLevel(log.DebugLevel)
}
return nil
}
if err := app.Run(os.Args); err != nil {
log.Fatal(err)
}
}
func getHostname() string {
if h, _ := os.Hostname(); h != "" {
return h
}
return "unknown"
}