Refactor
This commit is contained in:
12
peer/main.go
12
peer/main.go
@@ -6,18 +6,18 @@ import (
|
||||
)
|
||||
|
||||
func Main() {
|
||||
conf := mainArgs{}
|
||||
args := mainArgs{}
|
||||
|
||||
flag.StringVar(&conf.NetName, "name", "", "[REQUIRED] The network name.")
|
||||
flag.StringVar(&conf.HubAddress, "hub-address", "", "[REQUIRED] The hub address.")
|
||||
flag.StringVar(&conf.APIKey, "api-key", "", "[REQUIRED] The node's API key.")
|
||||
flag.StringVar(&args.NetName, "name", "", "[REQUIRED] The network name.")
|
||||
flag.StringVar(&args.HubAddress, "hub-address", "", "[REQUIRED] The hub address.")
|
||||
flag.StringVar(&args.APIKey, "api-key", "", "[REQUIRED] The node's API key.")
|
||||
flag.Parse()
|
||||
|
||||
if conf.NetName == "" || conf.HubAddress == "" || conf.APIKey == "" {
|
||||
if args.NetName == "" || args.HubAddress == "" || args.APIKey == "" {
|
||||
flag.Usage()
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
peer := newPeerMain(conf)
|
||||
peer := newPeerMain(args)
|
||||
peer.Run()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user