-
Notifications
You must be signed in to change notification settings - Fork 2
/
update-paths.js
23 lines (20 loc) · 1.13 KB
/
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.join(__dirname, './org1.convoracle.config.json');
const configFilePath2 = path.join(__dirname, './org2.convoracle.config.json');
const configFile = require(configFilePath);
const configFile2 = require(configFilePath2);
fs.writeFileSync(configFilePath, JSON.stringify({
...configFile,
keyStore: configFile.keyStore.replace(/^.+\/hyperledger-fabric-network/, path.join(homedir, 'hyperledger-fabric-network')),
networkProfile: configFile.networkProfile.replace(/^.+\/hyperledger-fabric-network/, path.join(homedir, 'hyperledger-fabric-network'))
}, null, 2));
fs.writeFileSync(configFilePath2, JSON.stringify({
...configFile,
keyStore: configFile.keyStore.replace(/^.+\/hyperledger-fabric-network/, path.join(homedir, 'hyperledger-fabric-network')),
networkProfile: configFile.networkProfile.replace(/^.+\/hyperledger-fabric-network/, path.join(homedir, 'hyperledger-fabric-network'))
}, null, 2));
console.log('Paths updated successfully')