-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
61 lines (46 loc) · 1.08 KB
/
main.go
File metadata and controls
61 lines (46 loc) · 1.08 KB
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
package main
import (
goflag "flag"
"fmt"
"time"
"github.com/blang/semver"
"github.com/golang/glog"
flag "github.com/spf13/pflag"
)
// MajorMinorPatch - semantic version string
var MajorMinorPatch string
// ReleaseType - release type
var ReleaseType = "alpha"
// GitCommitSha - git commit sha-1 hash
var GitCommitSha string
var gaCfg *config
func init() {
go Until(glog.Flush, 10*time.Second, NeverStop)
gaCfg = newConfig()
}
func displayVersion() {
semVer, err := semver.Make(MajorMinorPatch + "-" + ReleaseType + "+git.sha." + GitCommitSha)
if err != nil {
panic(err)
}
fmt.Println(semVer.String())
}
func main() {
flag.CommandLine.AddGoFlagSet(goflag.CommandLine)
flag.Parse()
gaCfg.flagSet = flag.CommandLine
// check for version flag, if present print veriosn and exit
if *gaCfg.version {
displayVersion()
return
}
gaCfg.envParse()
glog.V(2).Infof("main(): configuration: %v", gaCfg.String())
if false == gaCfg.validate() {
return
}
// Git Archivist Service
glog.V(2).Infof("main(): staring Git Archivist Service")
srv := newGAServer(gaCfg)
srv.run()
}