From fcd950e2702156b6f1eabfbd3086129b7ee269d6 Mon Sep 17 00:00:00 2001 From: Minh Doan Date: Wed, 6 Mar 2019 15:44:21 -0800 Subject: [PATCH] create global config --- cmd/harmony/main.go | 17 +++++++++++++---- internal/configs/node/config.go | 4 ++++ 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/cmd/harmony/main.go b/cmd/harmony/main.go index 87cfa67ec..08788bff1 100644 --- a/cmd/harmony/main.go +++ b/cmd/harmony/main.go @@ -115,10 +115,7 @@ var ( logConn = flag.Bool("log_conn", false, "log incoming/outgoing connections") ) -func main() { - flag.Var(&utils.BootNodes, "bootnodes", "a list of bootnode multiaddress") - flag.Parse() - +func initSetup() { if *versionFlag { printVersion(os.Args[0]) } @@ -139,6 +136,18 @@ func main() { } 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 peers []p2p.Peer diff --git a/internal/configs/node/config.go b/internal/configs/node/config.go index 572da7ed2..856daf1bb 100644 --- a/internal/configs/node/config.go +++ b/internal/configs/node/config.go @@ -82,6 +82,10 @@ func GetConfigs(index int) *ConfigType { return &configs[index] } +func GetGlobalConfig() *ConfigType { + return GetConfigs(Global) +} + 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) }