Merge pull request #824 from embark-framework/feature/swarm-use-local-datadir

Swarm use local data dir
This commit is contained in:
Iuri Matias 2018-09-14 18:07:54 -04:00 committed by GitHub
commit 286e1d2c95
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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);