add missing enable options to boilerplate configs; add communication initializer

This commit is contained in:
Iuri Matias 2017-02-20 16:29:59 -05:00
parent a9e4435b77
commit d1701c4031
5 changed files with 27 additions and 2 deletions

View File

@ -1,5 +1,6 @@
{
"development": {
"enabled": true,
"networkType": "custom",
"genesisBlock": "config/development/genesis.json",
"datadir": ".embark/development/datadir",
@ -14,6 +15,7 @@
}
},
"testnet": {
"enabled": true,
"networkType": "testnet",
"light": true,
"rpcHost": "localhost",
@ -24,6 +26,7 @@
}
},
"livenet": {
"enabled": true,
"networkType": "livenet",
"light": true,
"rpcHost": "localhost",
@ -34,6 +37,7 @@
}
},
"privatenet": {
"enabled": true,
"networkType": "custom",
"rpcHost": "localhost",
"rpcPort": 8545,

View File

@ -1,5 +1,6 @@
{
"default": {
"enabled": true,
"provider": "whisper"
}
}

View File

@ -1,5 +1,6 @@
{
"development": {
"enabled": true,
"networkType": "custom",
"genesisBlock": "config/development/genesis.json",
"datadir": ".embark/development/datadir",
@ -14,6 +15,7 @@
}
},
"testnet": {
"enabled": true,
"networkType": "testnet",
"light": true,
"rpcHost": "localhost",
@ -24,6 +26,7 @@
}
},
"livenet": {
"enabled": true,
"networkType": "livenet",
"light": true,
"rpcHost": "localhost",
@ -34,6 +37,7 @@
}
},
"privatenet": {
"enabled": true,
"networkType": "custom",
"rpcHost": "localhost",
"rpcPort": 8545,

View File

@ -1,5 +1,6 @@
{
"default": {
"enabled": true,
"provider": "whisper"
}
}

View File

@ -66,7 +66,7 @@ ABIGenerator.prototype.generateContracts = function(useEmbarkJS) {
return result;
};
ABIGenerator.prototype.generateStorageInitialiation = function(useEmbarkJS) {
ABIGenerator.prototype.generateStorageInitialization = function(useEmbarkJS) {
var self = this;
var result = "\n";
@ -79,13 +79,28 @@ ABIGenerator.prototype.generateStorageInitialiation = function(useEmbarkJS) {
return result;
};
ABIGenerator.prototype.generateCommunicationInitialization = function(useEmbarkJS) {
var self = this;
var result = "\n";
if (!useEmbarkJS || self.communicationConfig === {}) return;
if (self.communicationConfig.provider === 'ipfs' && self.communicationConfig.enabled === true) {
result += "\n" + "EmbarkJS.Storage.setProvider('" + self.communicationConfig.provider + "');";
} else if (self.communicationConfig.provider === 'orbit' && self.communicationConfig.enabled === true) {
result += "\n" + "EmbarkJS.Storage.setProvider('" + self.communicationConfig.provider + "', {server: '" + self.communicationConfig.host + "', port: '" + self.communicationConfig.port + "'});";
}
return result;
};
ABIGenerator.prototype.generateABI = function(options) {
var result = "";
result += this.generateProvider();
result += this.generateContracts(options.useEmbarkJS);
result += this.generateStorageInitialiation(options.useEmbarkJS);
result += this.generateStorageInitialization(options.useEmbarkJS);
result += this.generateCommunicationInitialization(options.useEmbarkJS);
return result;
};