OSDN Git Service

feat: add node discovery and status check (#374)
[bytom/vapor.git] / cmd / precognitive / main.go
1 package main
2
3 import (
4         "sync"
5
6         log "github.com/sirupsen/logrus"
7
8         "github.com/vapor/toolbar/common"
9         "github.com/vapor/toolbar/precognitive/api"
10         "github.com/vapor/toolbar/precognitive/config"
11         "github.com/vapor/toolbar/precognitive/monitor"
12 )
13
14 func main() {
15         cfg := config.NewConfig()
16         db, err := common.NewMySQLDB(cfg.MySQLConfig)
17         if err != nil {
18                 log.WithField("err", err).Panic("initialize mysql db error")
19         }
20
21         go monitor.NewMonitor(cfg, db).Run()
22         go api.NewApiServer(cfg, db).Run()
23
24         // keep the main func running in case of terminating goroutines
25         var wg sync.WaitGroup
26         wg.Add(1)
27         wg.Wait()
28 }