Skip to content

Commit

Permalink
FAB-1162 read MSP cfg from a global path
Browse files Browse the repository at this point in the history
https://jira.hyperledger.org/browse/FAB-1162

Anytime we assume full peer environment to be there (such as  based on GOPATH)
we prevent other environments that don’t have the full fabric from working.

We will follow other use of PEER_CFG_PATH to break that implied strong association
with a full fabric path.

Change-Id: Ief1e7b9e56f78039095e3ed29c588360b4bc6eab
Signed-off-by: Srinivasan Muralidharan <muralisr@us.ibm.com>
  • Loading branch information
Srinivasan Muralidharan committed Nov 20, 2016
1 parent 9d3abd1 commit 6d24ea7
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion peer/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,14 @@ func main() {

// Init the MSP
// TODO: determine the location of this config file
mspMgrConfigFile := os.Getenv("GOPATH") + "/src/github.com/hyperledger/fabric/msp/peer-config.json"
var mspMgrConfigFile string
if alternativeCfgPath != "" {
mspMgrConfigFile = alternativeCfgPath + "/msp/peer-config.json"
} else if _, err := os.Stat("./peer-config.json"); err == nil {
mspMgrConfigFile = "./peer-config.json"
} else {
mspMgrConfigFile = os.Getenv("GOPATH") + "/src/github.com/hyperledger/fabric/msp/peer-config.json"
}
err = msp.GetManager().Setup(mspMgrConfigFile)
if err != nil {
panic(fmt.Errorf("Fatal error when reading MSP config file %s: err %s\n", mspMgrConfigFile, err))
Expand Down

0 comments on commit 6d24ea7

Please sign in to comment.