OSDN Git Service

rename (#465)
[bytom/vapor.git] / cmd / fedd / main.go
1 package main
2
3 import (
4         "sync"
5
6         log "github.com/sirupsen/logrus"
7
8         "github.com/bytom/vapor/toolbar/federation/api"
9         "github.com/bytom/vapor/toolbar/federation/config"
10         "github.com/bytom/vapor/toolbar/federation/database"
11         "github.com/bytom/vapor/toolbar/common"
12         "github.com/bytom/vapor/toolbar/federation/synchron"
13 )
14
15 func main() {
16         cfg := config.NewConfig()
17         db, err := common.NewMySQLDB(cfg.MySQLConfig)
18         if err != nil {
19                 log.WithField("err", err).Panic("initialize mysql db error")
20         }
21
22         assetStore := database.NewAssetStore(db)
23         go synchron.NewMainchainKeeper(db, assetStore, cfg).Run()
24         go synchron.NewSidechainKeeper(db, assetStore, cfg).Run()
25         go api.NewServer(db, cfg).Run()
26
27         // keep the main func running in case of terminating goroutines
28         var wg sync.WaitGroup
29         wg.Add(1)
30         wg.Wait()
31 }