MCPcopy Index your code
hub / github.com/CovenantSQL/CovenantSQL / main

Function main

cmd/cqld/main.go:99–151  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

97}
98
99func main() {
100 flag.Parse()
101 log.SetStringLevel(logLevel, log.InfoLevel)
102 // set random
103 rand.Seed(time.Now().UnixNano())
104
105 if showVersion {
106 fmt.Printf("%v %v %v %v %v\n",
107 name, version, runtime.GOOS, runtime.GOARCH, runtime.Version())
108 os.Exit(0)
109 }
110
111 configFile = utils.HomeDirExpand(configFile)
112
113 flag.Visit(func(f *flag.Flag) {
114 log.Infof("args %#v : %s", f.Name, f.Value)
115 })
116
117 var err error
118 conf.GConf, err = conf.LoadConfig(configFile)
119 if err != nil {
120 log.WithField("config", configFile).WithError(err).Fatal("load config failed")
121 }
122
123 kms.InitBP()
124 log.Debugf("config:\n%#v", conf.GConf)
125 // BP Never Generate new key pair
126 conf.GConf.GenerateKeyPair = false
127
128 // init log
129 initLogs()
130
131 if !noLogo {
132 fmt.Print(logo)
133 }
134
135 if len(metricWeb) > 0 {
136 err = metric.InitMetricWeb(metricWeb)
137 if err != nil {
138 log.Errorf("start metric web server on %s failed: %v", metricWeb, err)
139 os.Exit(-1)
140 }
141 }
142 // init profile, if cpuProfile, memProfile length is 0, nothing will be done
143 _ = utils.StartProfile(cpuProfile, memProfile)
144 defer utils.StopProfile()
145
146 if err := runNode(conf.GConf.ThisNodeID, conf.GConf.ListenAddr); err != nil {
147 log.WithError(err).Fatal("run block producer node failed")
148 }
149
150 log.Info("server stopped")
151}

Callers 1

TestMainFunction · 0.70

Calls 15

SetStringLevelFunction · 0.92
HomeDirExpandFunction · 0.92
InfofFunction · 0.92
LoadConfigFunction · 0.92
WithFieldFunction · 0.92
InitBPFunction · 0.92
DebugfFunction · 0.92
InitMetricWebFunction · 0.92
ErrorfFunction · 0.92
StartProfileFunction · 0.92
StopProfileFunction · 0.92
WithErrorFunction · 0.92

Tested by 1

TestMainFunction · 0.56