-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
48 lines (38 loc) · 1.04 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
package main
import (
"flag"
"runtime"
"upgradationScript/common"
"upgradationScript/logger"
_ "github.com/Khan/genqlient/generate"
"github.com/OpsMx/go-app-base/version"
"go.uber.org/zap"
"go.uber.org/zap/zapcore"
)
var (
appName = "upgrade-job"
configFile = flag.String("configFile", "/app/config/"+appName+".yaml", "Configuration file location")
)
func main() {
zapConfig := zap.NewProductionConfig()
zapConfig.Level.SetLevel(zapcore.ErrorLevel)
logger.Logger, _ = zapConfig.Build()
logger.Sl = logger.Logger.Sugar()
zapConfig.Level.SetLevel(zap.DebugLevel)
logger.Logger, _ = zapConfig.Build()
logger.Sl = logger.Logger.Sugar()
logger.Sl.Infow("starting",
"appName", appName,
"version", version.VersionString(),
"gitBranch", version.GitBranch(),
"gitHash", version.GitHash(),
"buildType", version.BuildType(),
"os", runtime.GOOS,
"arch", runtime.GOARCH,
"cores", runtime.NumCPU(),
)
common.LoadConfigurationFile(*configFile)
if err := common.StartUpgrade(); err != nil {
logger.Sl.Fatal(err.Error())
}
}