create global config

pull/539/head
Minh Doan 6 years ago committed by Minh Doan
parent a87c940a57
commit fcd950e270
  1. 17
      cmd/harmony/main.go
  2. 4
      internal/configs/node/config.go

@ -115,10 +115,7 @@ var (
logConn = flag.Bool("log_conn", false, "log incoming/outgoing connections") logConn = flag.Bool("log_conn", false, "log incoming/outgoing connections")
) )
func main() { func initSetup() {
flag.Var(&utils.BootNodes, "bootnodes", "a list of bootnode multiaddress")
flag.Parse()
if *versionFlag { if *versionFlag {
printVersion(os.Args[0]) printVersion(os.Args[0])
} }
@ -139,6 +136,18 @@ func main() {
} }
utils.BootNodes = bootNodeAddrs utils.BootNodes = bootNodeAddrs
} }
}
func createGlobalConfig() *nodeconfig.ConfigType {
nodeConfig := nodeconfig.GetGlobalConfig()
return nodeConfig
}
func main() {
flag.Var(&utils.BootNodes, "bootnodes", "a list of bootnode multiaddress")
flag.Parse()
initSetup()
var shardID = "0" var shardID = "0"
var peers []p2p.Peer var peers []p2p.Peer

@ -82,6 +82,10 @@ func GetConfigs(index int) *ConfigType {
return &configs[index] return &configs[index]
} }
func GetGlobalConfig() *ConfigType {
return GetConfigs(Global)
}
func (conf *ConfigType) String() string { func (conf *ConfigType) String() string {
return fmt.Sprintf("%s/%s/%s:%v,%v,%v:%v", conf.beacon, conf.group, conf.client, conf.isClient, conf.isBeacon, conf.isLeader, conf.shardID) return fmt.Sprintf("%s/%s/%s:%v,%v,%v:%v", conf.beacon, conf.group, conf.client, conf.isClient, conf.isBeacon, conf.isLeader, conf.shardID)
} }

Loading…
Cancel
Save