X-Git-Url: http://git.osdn.net/view?p=bytom%2Fvapor.git;a=blobdiff_plain;f=cmd%2Fprecognitive%2Fmain.go;fp=cmd%2Fprecognitive%2Fmain.go;h=07913bef103965b6ffc387f678473e76d5fe7a15;hp=0000000000000000000000000000000000000000;hb=001e399d2d0eb8f6956b844e721e2f0a4680ff90;hpb=91c664e4bf08540d413f8cdd087d436c2bae2ac6 diff --git a/cmd/precognitive/main.go b/cmd/precognitive/main.go new file mode 100644 index 00000000..07913bef --- /dev/null +++ b/cmd/precognitive/main.go @@ -0,0 +1,28 @@ +package main + +import ( + "sync" + + log "github.com/sirupsen/logrus" + + "github.com/vapor/toolbar/common" + "github.com/vapor/toolbar/precognitive/api" + "github.com/vapor/toolbar/precognitive/config" + "github.com/vapor/toolbar/precognitive/monitor" +) + +func main() { + cfg := config.NewConfig() + db, err := common.NewMySQLDB(cfg.MySQLConfig) + if err != nil { + log.WithField("err", err).Panic("initialize mysql db error") + } + + go monitor.NewMonitor(cfg, db).Run() + go api.NewApiServer(cfg, db).Run() + + // keep the main func running in case of terminating goroutines + var wg sync.WaitGroup + wg.Add(1) + wg.Wait() +}