7 log "github.com/sirupsen/logrus"
9 vaporJson "github.com/vapor/encoding/json"
10 "github.com/vapor/toolbar/common"
13 func NewConfig() *Config {
14 if len(os.Args) <= 1 {
15 log.Fatal("Please setup the config file path")
18 return NewConfigWithPath(os.Args[1])
21 func NewConfigWithPath(path string) *Config {
22 configFile, err := os.Open(path)
24 log.WithFields(log.Fields{"err": err, "file_path": os.Args[1]}).Fatal("fail to open config file")
26 defer configFile.Close()
29 if err := json.NewDecoder(configFile).Decode(cfg); err != nil {
30 log.WithField("err", err).Fatal("fail to decode config file")
38 MySQLConfig common.MySQLConfig `json:"mysql"`
39 FederationProg vaporJson.HexBytes `json:"federation_prog"`
40 Mainchain Chain `json:"mainchain"`
41 Sidechain Chain `json:"sidechain"`
45 IsReleaseMode bool `json:"is_release_mode"`
49 Name string `json:"name"`
50 Upstream string `json:"upstream"`
51 SyncSeconds uint64 `json:"sync_seconds"`
52 Confirmations uint64 `json:"confirmations"`