Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bugfix/services-refactoring #138

Merged
merged 1 commit into from
Oct 25, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading