-
Notifications
You must be signed in to change notification settings - Fork 342
/
main.go
66 lines (54 loc) · 1.23 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
/*
This command provides an executable version of skipper with the default
set of filters.
For the list of command line options, run:
skipper -help
For details about the usage and extensibility of skipper, please see the
documentation of the root skipper package.
To see which built-in filters are available, see the skipper/filters
package documentation.
*/
package main
import (
"fmt"
"runtime"
"runtime/debug"
log "github.com/sirupsen/logrus"
"github.com/zalando/skipper"
"github.com/zalando/skipper/config"
)
var (
version string
commit string
)
func init() {
if info, ok := debug.ReadBuildInfo(); ok {
if version == "" {
version = info.Main.Version
}
if commit == "" {
for _, setting := range info.Settings {
if setting.Key == "vcs.revision" {
commit = setting.Value[:min(8, len(setting.Value))]
}
}
}
}
}
func main() {
cfg := config.NewConfig()
if err := cfg.Parse(); err != nil {
log.Fatalf("Error processing config: %s", err)
}
if cfg.PrintVersion {
fmt.Printf(
"Skipper version %s (commit: %s, runtime: %s)\n",
version, commit, runtime.Version(),
)
return
}
log.SetLevel(cfg.ApplicationLogLevel)
if err := skipper.Run(cfg.ToOptions()); err != nil {
log.Fatal(err)
}
}