Skip to content

Commit

Permalink
Merge pull request #138 from s7techlab/bugfix/services-refactoring
Browse files Browse the repository at this point in the history
bugfix/services-refactoring
  • Loading branch information
criro1 authored Oct 25, 2023
2 parents 9977c8d + 9e024e6 commit 5ef45b3
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion identity/msp.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,18 @@ func MSPFromPath(mspID, mspPath string, opts ...MSPOpt) (*MSP, error) {

mspInstance := &MSP{}

if len(mspOpts.signCert) != 0 && len(mspOpts.signKey) != 0 {
mspInstance.signer, err = NewSigningFromBytes(mspID, mspOpts.signCert, mspOpts.signKey)
if err != nil {
return nil, err
}
} else if mspOpts.signCertPath != "" && mspOpts.signKeyPath != "" {
mspInstance.signer, err = NewSigningFromFile(mspID, mspOpts.signCertPath, mspOpts.signKeyPath)
if err != nil {
return nil, err
}
}

// admin in separate msp path
if mspOpts.adminMSPPath != `` {
logger.Debug(`load admin identities from separate msp path`,
Expand Down Expand Up @@ -157,7 +169,7 @@ func MSPFromPath(mspID, mspPath string, opts ...MSPOpt) (*MSP, error) {
logger.Debug(`user identities loaded`, zap.Int(`num`, len(mspInstance.users)))
}

if mspOpts.signCertsPath != `` {
if mspOpts.signCertsPath != `` && mspInstance.signer == nil {
mspInstance.signer, err = FirstSigningFromPath(mspID, mspOpts.signCertsPath, mspOpts.keystorePath)
if err != nil {
return nil, fmt.Errorf(`read signer identity from=%s: %w`, mspOpts.signCertsPath, err)
Expand Down

0 comments on commit 5ef45b3

Please sign in to comment.