package main
+import (
+ "sync"
+
+ "github.com/vapor/toolbar/common"
+ "github.com/vapor/toolbar/precog/config"
+)
+
func main() {
+ cfg := config.NewConfig()
+ db, err := common.NewMySQLDB(cfg.MySQLConfig)
+ if err != nil {
+ log.WithField("err", err).Panic("initialize mysql db error")
+ }
+
+ // keep the main func running in case of terminating goroutines
+ var wg sync.WaitGroup
+ wg.Add(1)
+ wg.Wait()
}
"os"
log "github.com/sirupsen/logrus"
+ "github.com/vapor/crypto/ed25519/chainkd"
- vaporJson "github.com/vapor/encoding/json"
"github.com/vapor/toolbar/common"
)
return cfg
}
+
+type Config struct {
+ Policy Policy `json:"policy"`
+ MySQLConfig common.MySQLConfig `json:"mysql"`
+ Nodes []Node `json:"nodes"`
+}
+
+type Policy struct {
+ LantencyMS uint64 `json:"lantency_ms"`
+}
+
+type Node struct {
+ Alias string `json:"alias"`
+ HostPort string `json:"host_port"`
+ PubKey chainkd.XPub `json:"pubkey"`
+}