Skip to content

Commit

Permalink
fix save identity in config
Browse files Browse the repository at this point in the history
  • Loading branch information
zeroxbt committed Aug 4, 2022
1 parent 954a114 commit 80f96b9
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions ot-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ class OTNode {
) {
this.saveIdentityInUserConfigurationFile(
blockchainModuleManager.getIdentity(blockchain),
blockchain,
);
}
}
Expand Down Expand Up @@ -239,18 +240,17 @@ class OTNode {
}
}

saveIdentityInUserConfigurationFile(identity) {
saveIdentityInUserConfigurationFile(identity, blockchain) {
const configurationFilePath = path.join(appRootPath.path, '..', this.config.configFilename);
const configFile = JSON.parse(fs.readFileSync(configurationFilePath));
if (
configFile.modules.blockchain &&
configFile.modules.blockchain.implementation &&
configFile.modules.blockchain.implementation['web3-service'] &&
configFile.modules.blockchain.implementation['web3-service'].config
configFile.modules.blockchain.implementation[blockchain] &&
configFile.modules.blockchain.implementation[blockchain].config
) {
if (!configFile.modules.blockchain.implementation['web3-service'].config.identity) {
configFile.modules.blockchain.implementation['web3-service'].config.identity =
identity;
if (!configFile.modules.blockchain.implementation[blockchain].config.identity) {
configFile.modules.blockchain.implementation[blockchain].config.identity = identity;
fs.writeFileSync(configurationFilePath, JSON.stringify(configFile, null, 2));
}
}
Expand Down

0 comments on commit 80f96b9

Please sign in to comment.