Swarm use local data dir

This commit is contained in:
Anthony Laibe 2018-09-13 13:37:44 +01:00
parent 323ec0d529
commit 8ffc9b89e2
3 changed files with 10 additions and 5 deletions

View File

@ -64,7 +64,7 @@ var Blockchain = function(options) {
this.config.account = {};
this.config.account.password = fs.embarkPath("templates/boilerplate/config/development/password");
this.config.genesisBlock = fs.embarkPath("templates/boilerplate/config/development/genesis.json");
this.config.datadir = fs.embarkPath(".embark/development/datadir");
this.config.datadir = fs.dappPath(".embark/development/datadir");
}
const spaceMessage = 'The path for %s in blockchain config contains spaces, please remove them';

View File

@ -113,6 +113,7 @@ class StorageProcessesLauncher {
self.processes[storageName].send({
action: constants.blockchain.init, options: {
storageConfig: self.storageConfig,
blockchainConfig: self.blockchainConfig,
cors: self.buildCors(storageName)
}
});

View File

@ -9,6 +9,7 @@ class SwarmProcess extends ProcessWrapper {
constructor(options) {
super();
this.storageConfig = options.storageConfig;
this.blockchainConfig = options.blockchainConfig;
this.cors = options.cors;
this.command = this.storageConfig.swarmPath || 'swarm';
}
@ -19,11 +20,14 @@ class SwarmProcess extends ProcessWrapper {
return 'Account address and password are needed in the storage config to start the Swarm process';
}
const datadir = this.blockchainConfig.datadir || fs.dappPath(`.embark/development/datadir`);
const args = [
`--bzzaccount=${this.storageConfig.account.address}`,
`--password=${fs.dappPath(this.storageConfig.account.password)}`,
`--corsdomain=${self.cors.join(',')}`
];
'--datadir', datadir,
'--bzzaccount', this.storageConfig.account.address,
'--password', fs.dappPath(this.storageConfig.account.password),
'--corsdomain', self.cors.join(',')
];
console.trace('Starting swarm process with arguments: ' + args.join(' '));
this.child = child_process.spawn(this.command, args);