forked from instamed/healthcare-payments-blockchain
-
Notifications
You must be signed in to change notification settings - Fork 0
/
update-paths.js
23 lines (18 loc) · 830 Bytes
/
update-paths.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
const os = require('os');
const fs = require('fs');
const path = require('path');
const homedir = os.homedir();
console.log('Replacing references in config.json');
const configFilePath = path.resolve(__dirname, 'chaincode.config.json');
try {
const configFile = JSON.parse(fs.readFileSync(configFilePath));
const updatedConfig = {
...configFile,
keyStore: configFile.keyStore.replace(/^.+\/hyperledger-fabric-network/, path.resolve(homedir, 'hyperledger-fabric-network')),
networkProfile: configFile.networkProfile.replace(/^.+\/hyperledger-fabric-network/, path.resolve(homedir, 'hyperledger-fabric-network')),
};
fs.writeFileSync(configFilePath, JSON.stringify(updatedConfig, null, 2));
console.log('Paths updated successfully');
} catch (error) {
console.error(`Error updating paths: ${error}`);
}