-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
39 lines (31 loc) · 973 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
package main
import (
"context"
"math/rand"
"strings"
"time"
log "github.com/Sirupsen/logrus"
"github.com/danielkrainas/gobag/cmd"
"github.com/danielkrainas/gobag/context"
_ "github.com/danielkrainas/csense/cmd/agent"
"github.com/danielkrainas/csense/cmd/root"
_ "github.com/danielkrainas/csense/cmd/version"
_ "github.com/danielkrainas/csense/containers/driver/embedded"
_ "github.com/danielkrainas/csense/storage/driver/consul"
_ "github.com/danielkrainas/csense/storage/driver/etcd"
_ "github.com/danielkrainas/csense/storage/driver/inmemory"
)
var appVersion string
const defaultVersion = "0.0.0-dev"
func main() {
if appVersion == "" {
appVersion = defaultVersion
}
rand.Seed(time.Now().Unix())
ctx := acontext.WithVersion(acontext.Background(), appVersion)
ctx = context.WithValue(ctx, "app.name", strings.Title(root.Info.Use))
dispatch := cmd.CreateDispatcher(ctx, root.Info)
if err := dispatch(); err != nil {
log.Fatalln(err)
}
}