Skip to content

Commit

Permalink
[BE-742] Fix return value about getOrganizationsConfig (#106)
Browse files Browse the repository at this point in the history
* [BE-742] Fix return value about getOrganizationsConfig

* I changed return value to return only one organization
* Standard of return value is the value in config.client.organization

Signed-off-by: 5pecia1 <pdpxpd@gmail.com>

* change orgMsp type array to string

Signed-off-by: 5pecia1 <pdpxpd@gmail.com>
  • Loading branch information
5pecia1 committed May 22, 2020
1 parent 7b30821 commit dd00ce6
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 16 deletions.
30 changes: 16 additions & 14 deletions app/platform/fabric/FabricConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,16 @@ class FabricConfig {
return false;
}

/**
*
*
* @returns
* @memberof FabricConfig
*/
getOrganization() {
return this.config.client.organization;
}

/**
*
*
Expand Down Expand Up @@ -172,20 +182,12 @@ class FabricConfig {
* @memberof FabricConfig
*/
getOrganizationsConfig() {
const orgMsp = [];
let adminPrivateKeyPath;
let signedCertPath;
for (const x in this.config.organizations) {
if (this.config.organizations[x].mspid) {
orgMsp.push(this.config.organizations[x].mspid);
}
if (this.config.organizations[x].adminPrivateKey) {
adminPrivateKeyPath = this.config.organizations[x].adminPrivateKey.path;
}
if (this.config.organizations[x].signedCert) {
signedCertPath = this.config.organizations[x].signedCert.path;
}
}
const organization = this.config.organizations[this.getOrganization()];

const orgMsp = organization.mspid;
const adminPrivateKeyPath = organization.adminPrivateKey.path;
const signedCertPath = organization.signedCert.path;

return { orgMsp, adminPrivateKeyPath, signedCertPath };
}

Expand Down
4 changes: 2 additions & 2 deletions app/platform/fabric/gateway/FabricGateway.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class FabricGateway {
const peers = this.fabricConfig.getPeers();
this.defaultPeer = peers[0].name;
this.defaultPeerUrl = peers[0].url;
let orgMsp = [];
let orgMsp;
let signedCertPath;
let adminPrivateKeyPath;
logger.log('========== > defaultPeer ', this.defaultPeer);
Expand All @@ -80,7 +80,7 @@ class FabricGateway {
);

this.defaultChannelName = this.fabricConfig.getDefaultChannel();
this.mspId = orgMsp[0];
this.mspId = orgMsp;
let caURL = [];
let serverCertPath = null;
({ caURL, serverCertPath } = this.fabricConfig.getCertificateAuthorities());
Expand Down

0 comments on commit dd00ce6

Please sign in to comment.