Commit fb6c9e70 authored by Jonathan Levi (HACERA)'s avatar Jonathan Levi (HACERA) Committed by Gerrit Code Review
Browse files

Merge "[FAB-5141] configtxgen --version should not panic"

parents 37be9010 d4adf7ab
......@@ -23,6 +23,7 @@ import (
"fmt"
"io/ioutil"
"os"
"strings"
"github.com/hyperledger/fabric/bccsp/factory"
"github.com/hyperledger/fabric/common/config"
......@@ -347,17 +348,30 @@ func main() {
flag.Parse()
// show version
if *version {
printVersion()
os.Exit(exitCode)
}
logging.SetLevel(logging.INFO, "")
// don't need to panic when running via command line
defer func() {
if err := recover(); err != nil {
if strings.Contains(fmt.Sprint(err), "Error reading configuration: Unsupported Config Type") {
logger.Error("Could not find configtx.yaml. " +
"Please make sure that FABRIC_CFG_PATH is set to a path " +
"which contains configtx.yaml")
}
os.Exit(1)
}
}()
logger.Info("Loading configuration")
factory.InitFactories(nil)
config := genesisconfig.Load(profile)
if *version {
printVersion()
os.Exit(exitCode)
}
if outputBlock != "" {
if err := doOutputBlock(config, channelID, outputBlock); err != nil {
logger.Fatalf("Error on outputBlock: %s", err)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment