OSDN Git Service

feat(warder): add warder backbone (#181)
[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/vapor/federation/api"
9         "github.com/vapor/federation/config"
10         "github.com/vapor/federation/database"
11         "github.com/vapor/federation/synchron"
12 )
13
14 func main() {
15         cfg := config.NewConfig()
16         db, err := database.NewMySQLDB(cfg.MySQLConfig)
17         if err != nil {
18                 log.WithField("err", err).Panic("initialize mysql db error")
19         }
20
21         assetStore := database.NewAssetStore(db)
22         go synchron.NewMainchainKeeper(db, assetStore, cfg).Run()
23         go synchron.NewSidechainKeeper(db, assetStore, cfg).Run()
24         go api.NewServer(db, cfg).Run()
25
26         // keep the main func running in case of terminating goroutines
27         var wg sync.WaitGroup
28         wg.Add(1)
29         wg.Wait()
30 }