Storage config improvements start. Adjusted the config and have started to support those improvements through the codebase.

Currently stuck on starting multiple storage servcies at once. Might need  a change in storage config spec.

WIP.
This commit is contained in:
emizzle 2018-05-25 17:13:57 +10:00
parent 0d5c7e6939
commit a26fbfff36
17 changed files with 220 additions and 98 deletions

View File

@ -230,7 +230,22 @@ EmbarkJS.Storage.setProvider = function(provider, options) {
return providerObj.setProvider(options); return providerObj.setProvider(options);
}; };
EmbarkJS.Storage.setProviders = function(provider, dappConnOptions) {
let providerObj = this.Providers[provider];
if (!providerObj) {
throw new Error('Unknown storage provider');
}
this.currentStorage = providerObj;
return providerObj.setProviders(dappConnOptions);
};
EmbarkJS.Storage.isAvailable = function(){ EmbarkJS.Storage.isAvailable = function(){
if (!this.currentStorage) {
throw new Error('Storage provider not set; e.g EmbarkJS.Storage.setProvider("ipfs")');
}
return this.currentStorage.isAvailable(); return this.currentStorage.isAvailable();
}; };

View File

@ -207,7 +207,7 @@ Config.prototype.loadExternalContractsFiles = function() {
}; };
Config.prototype.loadStorageConfigFile = function() { Config.prototype.loadStorageConfigFile = function() {
var versions = utils.recursiveMerge({"ipfs-api": "17.2.4"}, this.embarkConfig.versions || {}); var versions = utils.recursiveMerge({"ipfs-api": "17.2.4", "p-iteration": "1.1.7"}, this.embarkConfig.versions || {});
var configObject = { var configObject = {
"default": { "default": {
@ -215,11 +215,13 @@ Config.prototype.loadStorageConfigFile = function() {
"enabled": true, "enabled": true,
"available_providers": ["ipfs", "swarm"], "available_providers": ["ipfs", "swarm"],
"ipfs_bin": "ipfs", "ipfs_bin": "ipfs",
"provider": "ipfs", "upload": {
"protocol": "http", "provider": "ipfs",
"host": "localhost", "protocol": "http",
"port": 5001, "host": "localhost",
"getUrl": "http://localhost:8080/ipfs/" "port": 5001,
"getUrl": "http://localhost:8080/ipfs/"
}
} }
}; };

View File

@ -105,10 +105,9 @@ class Engine {
"deployment": this.deploymentService, "deployment": this.deploymentService,
"fileWatcher": this.fileWatchService, "fileWatcher": this.fileWatchService,
"webServer": this.webServerService, "webServer": this.webServerService,
"ipfs": this.ipfsService,
"web3": this.web3Service, "web3": this.web3Service,
"libraryManager": this.libraryManagerService, "libraryManager": this.libraryManagerService,
"swarm": this.swarmService "storage": this.storageService
}; };
let service = services[serviceName]; let service = services[serviceName];
@ -133,8 +132,8 @@ class Engine {
logger: this.logger, logger: this.logger,
plugins: this.plugins plugins: this.plugins
}); });
this.events.on('code-generator-ready', function () { this.events.on('code-generator-ready', function () {
console.log('CODE GENERATOR READY EVENT FIRED');
self.events.request('code', function (abi, contractsJSON) { self.events.request('code', function (abi, contractsJSON) {
pipeline.build(abi, contractsJSON, null, () => { pipeline.build(abi, contractsJSON, null, () => {
if (self.watch) { if (self.watch) {
@ -263,16 +262,13 @@ class Engine {
}); });
} }
ipfsService(_options) { storageService(_options) {
this.registerModule('ipfs', { this.registerModule('ipfs', {
addCheck: this.servicesMonitor.addCheck.bind(this.servicesMonitor), addCheck: this.servicesMonitor.addCheck.bind(this.servicesMonitor),
storageConfig: this.config.storageConfig, storageConfig: this.config.storageConfig,
host: _options.host, host: _options.host,
port: _options.port port: _options.port
}); });
}
swarmService(_options) {
this.registerModule('swarm', { this.registerModule('swarm', {
addCheck: this.servicesMonitor.addCheck.bind(this.servicesMonitor), addCheck: this.servicesMonitor.addCheck.bind(this.servicesMonitor),
storageConfig: this.config.storageConfig, storageConfig: this.config.storageConfig,

View File

@ -127,5 +127,10 @@
"Cannot upload: {{platform}} node is not running on {{protocol}}://{{host}}:{{port}}.": "Cannot upload: {{platform}} node is not running on {{protocol}}://{{host}}:{{port}}.", "Cannot upload: {{platform}} node is not running on {{protocol}}://{{host}}:{{port}}.": "Cannot upload: {{platform}} node is not running on {{protocol}}://{{host}}:{{port}}.",
"Error while downloading the file": "Error while downloading the file", "Error while downloading the file": "Error while downloading the file",
"Error while loading the content of ": "Error while loading the content of ", "Error while loading the content of ": "Error while loading the content of ",
"no contracts found": "no contracts found" "no contracts found": "no contracts found",
"IPFS node is offline": "IPFS node is offline",
"IPFS node detected": "IPFS node detected",
"Webserver is offline": "Webserver is offline",
"DApp path length is too long: \"": "DApp path length is too long: \"",
"This is known to cause issues with some applications, please consider reducing your DApp path's length to 66 characters or less.": "This is known to cause issues with some applications, please consider reducing your DApp path's length to 66 characters or less."
} }

View File

@ -122,10 +122,9 @@ class Embark {
engine.startService("web3"); engine.startService("web3");
engine.startService("pipeline"); engine.startService("pipeline");
engine.startService("deployment"); engine.startService("deployment");
engine.startService('storage');
engine.startService("codeGenerator"); engine.startService("codeGenerator");
// TODO: this should be just 'storage' and the storage should figure out the module
engine.startService(engine.config.storageConfig.provider);
engine.events.on('check:backOnline:Ethereum', function () { engine.events.on('check:backOnline:Ethereum', function () {
engine.logger.info(__('Ethereum node detected') + '..'); engine.logger.info(__('Ethereum node detected') + '..');
engine.config.reloadConfig(); engine.config.reloadConfig();
@ -198,10 +197,8 @@ class Embark {
engine.startService("web3"); engine.startService("web3");
engine.startService("pipeline"); engine.startService("pipeline");
engine.startService("deployment", {onlyCompile: options.onlyCompile}); engine.startService("deployment", {onlyCompile: options.onlyCompile});
engine.startService("storage");
engine.startService("codeGenerator"); engine.startService("codeGenerator");
// TODO: this should be just 'storage' and the storage should figure out the modules to load
engine.startService("ipfs");
engine.startService("swarm");
callback(); callback();
}, },
function deploy(callback) { function deploy(callback) {
@ -254,8 +251,8 @@ class Embark {
engine.startService("libraryManager"); engine.startService("libraryManager");
engine.startService("pipeline"); engine.startService("pipeline");
engine.startService("deployment", {onlyCompile: true}); engine.startService("deployment", {onlyCompile: true});
engine.startService("codeGenerator"); engine.startService("codeGenerator");
engine.deployManager.deployContracts(function (err) { engine.deployManager.deployContracts(function (err) {
callback(err); callback(err);
}); });
@ -304,7 +301,7 @@ class Embark {
}); });
engine.init(); engine.init();
let platform = engine.config.storageConfig.provider; let platform = engine.config.storageConfig.upload.provider;
let cmdPlugin; let cmdPlugin;
async.waterfall([ async.waterfall([
@ -316,9 +313,8 @@ class Embark {
engine.startService("web3"); engine.startService("web3");
engine.startService("pipeline"); engine.startService("pipeline");
engine.startService("deployment"); engine.startService("deployment");
engine.startService('storage');
engine.startService("codeGenerator"); engine.startService("codeGenerator");
// TODO: this should be just 'storage' and the storage should figure out the modules to load
engine.startService(platform.toLowerCase());
engine.startMonitor(); engine.startMonitor();
callback(); callback();
}, },
@ -335,7 +331,8 @@ class Embark {
} }
checkFn.fn(function (serviceCheckResult) { checkFn.fn(function (serviceCheckResult) {
if (!serviceCheckResult.status || serviceCheckResult.status === 'off') { if (!serviceCheckResult.status || serviceCheckResult.status === 'off') {
return callback({message: __('Cannot upload: {{platform}} node is not running on {{protocol}}://{{host}}:{{port}}.', {platform: platform, protocol: engine.config.storageConfig.protocol, host: engine.config.storageConfig.host, port: engine.config.storageConfig.port})}); let config = engine.config.storageConfig.upload;
return callback({message: __('Cannot upload: {{platform}} node is not running on {{protocol}}://{{host}}:{{port}}.', {platform: platform, protocol: config.protocol, host: config.host, port: config.port})});
} }
callback(); callback();
}); });
@ -357,8 +354,7 @@ class Embark {
}); });
} }
if (!cmdPlugin) { if (!cmdPlugin) {
engine.logger.info(__('try "{{ipfs}}" or "{{swarm}}"', {ipfs: 'embark upload ipfs', swarm: 'embark upload swarm'}).green); return callback({message: __('platform "{{platform}}" is specified as the upload provider, however no plugins have registered an upload command for "{{platform}}".', {platform: platform})});
return callback({message: 'unknown platform: ' + platform});
} }
callback(); callback();
}, },

View File

@ -1,4 +1,5 @@
import IpfsApi from 'ipfs-api'; import IpfsApi from 'ipfs-api';
//import {some} from 'p-iteration';
let __embarkIPFS = {}; let __embarkIPFS = {};
@ -10,7 +11,7 @@ __embarkIPFS.setProvider = function (options) {
self.ipfsConnection = IpfsApi('localhost', '5001'); self.ipfsConnection = IpfsApi('localhost', '5001');
self._getUrl = "http://localhost:8080/ipfs/"; self._getUrl = "http://localhost:8080/ipfs/";
} else { } else {
var ipfsOptions = {host: options.server, protocol: 'http'}; var ipfsOptions = {host: options.host || options.server, protocol: 'http'};
if (options.protocol) { if (options.protocol) {
ipfsOptions.protocol = options.protocol; ipfsOptions.protocol = options.protocol;
} }
@ -22,7 +23,7 @@ __embarkIPFS.setProvider = function (options) {
} }
resolve(self); resolve(self);
} catch (err) { } catch (err) {
console.log(err); console.error(err);
self.ipfsConnection = null; self.ipfsConnection = null;
reject(new Error('Failed to connect to IPFS')); reject(new Error('Failed to connect to IPFS'));
} }
@ -30,6 +31,29 @@ __embarkIPFS.setProvider = function (options) {
return promise; return promise;
}; };
__embarkIPFS.setProviders = async function (dappConnOptions) {
var self = this;
try {
let workingConnFound = await some(dappConnOptions, async (dappConn) => {
if(dappConn === '$BZZ' || dappConn.provider !== 'ipfs') return false; // swarm has no bearing for ipfs plugin, continue
else {
// set the provider then check the connection, if true, use that provider, else, check next provider
try{
await self.setProvider(dappConn);
return await self.isAvailable();
} catch(err) {
return false;
}
}
});
if(!workingConnFound) throw new Error('Could not connect to IPFS using any of the dappConnections in the storage config');
else return self;
} catch (err) {
self.ipfsConnection = null;
throw new Error('Failed to connect to IPFS: ' + err.message);
}
};
__embarkIPFS.saveText = function (text) { __embarkIPFS.saveText = function (text) {
const self = this; const self = this;
var promise = new Promise(function (resolve, reject) { var promise = new Promise(function (resolve, reject) {
@ -119,3 +143,4 @@ __embarkIPFS.getUrl = function (hash) {
return (this._getUrl || "http://localhost:8080/ipfs/") + hash; return (this._getUrl || "http://localhost:8080/ipfs/") + hash;
}; };

View File

@ -3,6 +3,7 @@ let utils = require('../../utils/utils.js');
let fs = require('../../core/fs.js'); let fs = require('../../core/fs.js');
let RunCode = require('../../coderunner/runCode'); let RunCode = require('../../coderunner/runCode');
let IpfsApi = require('ipfs-api'); let IpfsApi = require('ipfs-api');
const _ = require('underscore');
class IPFS { class IPFS {
@ -11,8 +12,9 @@ class IPFS {
this.events = embark.events; this.events = embark.events;
this.buildDir = options.buildDir; this.buildDir = options.buildDir;
this.storageConfig = options.storageConfig; this.storageConfig = options.storageConfig;
this.host = options.host || this.storageConfig.host; this.host = options.host || this.storageConfig.upload.host;
this.port = options.port || this.storageConfig.port; this.port = options.port || this.storageConfig.upload.port;
this.protocol = options.protocol || this.storageConfig.upload.protocol;
this.addCheck = options.addCheck; this.addCheck = options.addCheck;
this.embark = embark; this.embark = embark;
@ -41,7 +43,7 @@ class IPFS {
if (!storageConfig.enabled) { if (!storageConfig.enabled) {
return; return;
} }
if (storageConfig.provider !== 'ipfs' && storageConfig.available_providers.indexOf("ipfs") < 0) { if (storageConfig.upload.provider !== 'ipfs' || storageConfig.available_providers.indexOf("ipfs") < 0) {
return; return;
} }
@ -59,7 +61,13 @@ class IPFS {
self.addCheck('IPFS', function (cb) { self.addCheck('IPFS', function (cb) {
self.logger.trace("Checking IPFS version..."); self.logger.trace("Checking IPFS version...");
utils.httpGetJson('http://' + self.host + ':' + self.port + '/api/v0/version', function (err, body) { let url = (self.protocol || 'http') + '://' + self.host + ':' + self.port + '/api/v0/version';
if(self.protocol !== 'https'){
utils.httpGetJson(url, versionCb);
} else {
utils.httpsGetJson(url, versionCb);
}
function versionCb(err, body) {
if (err) { if (err) {
self.logger.trace("Check IPFS version error: " + err); self.logger.trace("Check IPFS version error: " + err);
return cb({name: "IPFS ", status: 'off'}); return cb({name: "IPFS ", status: 'off'});
@ -68,7 +76,7 @@ class IPFS {
return cb({name: ("IPFS " + body.Version), status: 'on'}); return cb({name: ("IPFS " + body.Version), status: 'on'});
} }
return cb({name: "IPFS ", status: 'on'}); return cb({name: "IPFS ", status: 'on'});
}); }
}); });
} }
@ -79,7 +87,7 @@ class IPFS {
return; return;
} }
if ((this.storageConfig.available_providers.indexOf('ipfs') < 0) && (this.storageConfig.provider !== 'ipfs' || this.storageConfig.enabled !== true)) { if (this.storageConfig.available_providers.indexOf('ipfs') < 0 || _.findWhere(this.storageConfig.dappConnection, {'provider': 'ipfs'}) === undefined || this.storageConfig.enabled !== true) {
return; return;
} }
@ -92,6 +100,15 @@ class IPFS {
} }
}); });
self.events.request("version:get:p-iteration", function(pIterationVersion) {
let currentPIterationVersion = require('../../../package.json').dependencies["p-iteration"];
if (pIterationVersion !== currentPIterationVersion) {
self.events.request("version:getPackageLocation", "p-iteration", pIterationVersion, function(err, location) {
self.embark.registerImportFile("p-iteration", fs.dappPath(location));
});
}
});
let code = ""; let code = "";
code += "\n" + fs.readFileSync(utils.joinPath(__dirname, 'embarkjs.js')).toString(); code += "\n" + fs.readFileSync(utils.joinPath(__dirname, 'embarkjs.js')).toString();
code += "\nEmbarkJS.Storage.registerProvider('ipfs', __embarkIPFS);"; code += "\nEmbarkJS.Storage.registerProvider('ipfs', __embarkIPFS);";
@ -100,16 +117,10 @@ class IPFS {
} }
addSetProvider() { addSetProvider() {
let config = JSON.stringify({ let code = "\nEmbarkJS.Storage.setProviders('ipfs'," + JSON.stringify(this.storageConfig.dappConnection) + ");";
server: this.storageConfig.host,
port: this.storageConfig.port,
protocol: this.storageConfig.protocol,
getUrl: this.storageConfig.getUrl
});
let code = "\nEmbarkJS.Storage.setProvider('ipfs'," + config + ");";
let shouldInit = (storageConfig) => { let shouldInit = (storageConfig) => {
return (storageConfig.provider === 'ipfs' && storageConfig.enabled === true); return (this.storageConfig.dappConnection !== undefined && this.storageConfig.dappConnection.some((dappConn) => dappConn.provider === 'ipfs') && storageConfig.enabled === true);
}; };
this.embark.addProviderInit('storage', code, shouldInit); this.embark.addProviderInit('storage', code, shouldInit);

View File

@ -1,20 +1,19 @@
/*global web3 */ /*global web3 */
let __embarkSwarm = {}; let __embarkSwarm = {};
const bytes = require("eth-lib/lib/bytes"); const bytes = require("eth-lib/lib/bytes");
import {some} from 'p-iteration';
__embarkSwarm.setProvider = function (options) { __embarkSwarm.setProvider = function (options) {
this.bzz = web3.bzz; this.bzz = web3.bzz;
this.protocol = options.protocol; this.protocol = options.protocol || 'http';
this.host = options.host; this.connectUrl = `${this.protocol}://${options.host}:${options.port}`;
this.port = options.port;
this.connectUrl = `${options.protocol}://${options.host}:${options.port}`;
this.connectError = new Error(`Cannot connect to Swarm node on ${this.connectUrl}`); this.connectError = new Error(`Cannot connect to Swarm node on ${this.connectUrl}`);
this._getUrl = options.getUrl || `${this.connectUrl}/bzzr:/`; //this._getUrl = options.getUrl || `${this.connectUrl}/bzzr:/`;
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
try { try {
if (!this.bzz.currentProvider) { if (!this.bzz.currentProvider) {
this.bzz.setProvider(`${options.protocol}://${options.host}:${options.port}`); this.bzz.setProvider(this.connectUrl);
} }
resolve(this); resolve(this);
} catch (err) { } catch (err) {
@ -24,6 +23,28 @@ __embarkSwarm.setProvider = function (options) {
}); });
}; };
__embarkSwarm.setProviders = async function (dappConnOptions) {
var self = this;
try {
let workingConnFound = await some(dappConnOptions, async (dappConn) => {
if(dappConn === '$BZZ'){
return self.isAvailable();
}
else if(dappConn.provider === 'swarm')
{
// set the provider then check the connection, if true, use that provider, else, check next provider
await self.setProvider(dappConn);
return self.isAvailable();
}
else return false;
});
if(!workingConnFound) throw new Error('Could not connect to Swarm using any of the dappConnections in the storage config');
else return self;
} catch (err) {
throw new Error('Failed to connect to Swarm: ' + err.message);
}
};
__embarkSwarm.isAvailable = function () { __embarkSwarm.isAvailable = function () {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
if (!this.bzz) { if (!this.bzz) {

View File

@ -9,8 +9,9 @@ class Swarm {
this.events = embark.events; this.events = embark.events;
this.buildDir = options.buildDir; this.buildDir = options.buildDir;
this.storageConfig = options.storageConfig; this.storageConfig = options.storageConfig;
this.host = options.host || this.storageConfig.host; this.host = options.host || options.storageConfig.upload.host;
this.port = options.port || this.storageConfig.port; this.port = options.port || options.storageConfig.upload.port;
this.protocol = options.protocol || options.storageConfig.upload.protocol;
this.addCheck = options.addCheck; this.addCheck = options.addCheck;
this.embark = embark; this.embark = embark;
this.bzz = options.bzz; this.bzz = options.bzz;
@ -24,7 +25,7 @@ class Swarm {
initSwarmProvider(){ initSwarmProvider(){
if(!this.bzz.currentProvider) { if(!this.bzz.currentProvider) {
this.bzz.setProvider(`http://${this.host}:${this.port}`); this.bzz.setProvider(`${this.protocol}://${this.host}:${this.port}`);
} }
} }
@ -47,7 +48,7 @@ class Swarm {
if (!storageConfig.enabled) { if (!storageConfig.enabled) {
return; return;
} }
if (storageConfig.provider !== 'swarm' && storageConfig.available_providers.indexOf("swarm") < 0) { if (storageConfig.upload.provider !== 'swarm' || storageConfig.available_providers.indexOf("swarm") < 0) {
return; return;
} }
@ -76,15 +77,25 @@ class Swarm {
} }
addSwarmToEmbarkJS() { addSwarmToEmbarkJS() {
let self = this;
// TODO: make this a shouldAdd condition // TODO: make this a shouldAdd condition
if (this.storageConfig === {}) { if (this.storageConfig === {}) {
return; return;
} }
if ((this.storageConfig.available_providers.indexOf('swarm') < 0) && (this.storageConfig.provider !== 'swarm' || this.storageConfig.enabled !== true)) { if (this.storageConfig.available_providers.indexOf('swarm') < 0 || this.storageConfig.enabled !== true) {
return; return;
} }
this.events.request("version:get:p-iteration", function(pIterationVersion) {
let currentPIterationVersion = require('../../../package.json').dependencies["p-iteration"];
if (pIterationVersion !== currentPIterationVersion) {
self.events.request("version:getPackageLocation", "p-iteration", pIterationVersion, function(err, location) {
self.embark.registerImportFile("p-iteration", fs.dappPath(location));
});
}
});
let code = ""; let code = "";
code += "\n" + fs.readFileSync(utils.joinPath(__dirname, 'embarkjs.js')).toString(); code += "\n" + fs.readFileSync(utils.joinPath(__dirname, 'embarkjs.js')).toString();
code += "\nEmbarkJS.Storage.registerProvider('swarm', __embarkSwarm);"; code += "\nEmbarkJS.Storage.registerProvider('swarm', __embarkSwarm);";
@ -93,16 +104,10 @@ class Swarm {
} }
addSetProvider() { addSetProvider() {
let config = JSON.stringify({ let code = "\nEmbarkJS.Storage.setProviders('swarm'," + JSON.stringify(this.storageConfig.dappConnection) + ");";
host: this.storageConfig.host,
port: this.storageConfig.port,
protocol: this.storageConfig.protocol,
getUrl: this.storageConfig.getUrl
});
let code = "\nEmbarkJS.Storage.setProvider('swarm'," + config + ");";
let shouldInit = (storageConfig) => { let shouldInit = (storageConfig) => {
return (storageConfig.provider === 'swarm' && storageConfig.enabled === true); return (this.storageConfig.dappConnection !== undefined && this.storageConfig.dappConnection.some((dappConn) => dappConn.provider === 'swarm') && storageConfig.enabled === true);
}; };
this.embark.addProviderInit('storage', code, shouldInit); this.embark.addProviderInit('storage', code, shouldInit);

View File

@ -69,6 +69,17 @@ function httpGetJson(url, callback) {
}); });
} }
function httpsGetJson(url, callback) {
httpGetRequest(https, url, function(err, body) {
try {
let parsed = JSON.parse(body);
return callback(err, parsed);
} catch(e) {
return callback(e);
}
});
}
function runCmd(cmd, options) { function runCmd(cmd, options) {
let result = shelljs.exec(cmd, options || {silent: true}); let result = shelljs.exec(cmd, options || {silent: true});
if (result.code !== 0) { if (result.code !== 0) {
@ -208,6 +219,7 @@ module.exports = {
httpGet: httpGet, httpGet: httpGet,
httpsGet: httpsGet, httpsGet: httpsGet,
httpGetJson: httpGetJson, httpGetJson: httpGetJson,
httpsGetJson: httpsGetJson,
runCmd: runCmd, runCmd: runCmd,
cd: cd, cd: cd,
sed: sed, sed: sed,

View File

@ -23,15 +23,17 @@ class LibraryManager {
let solcVersionInConfig = this.contractsConfig.versions.solc; let solcVersionInConfig = this.contractsConfig.versions.solc;
let web3VersionInConfig = this.contractsConfig.versions["web3"]; let web3VersionInConfig = this.contractsConfig.versions["web3"];
let ipfsApiVersion = this.storageConfig.versions["ipfs-api"]; let ipfsApiVersion = this.storageConfig.versions["ipfs-api"];
let pIterationVersion = this.storageConfig.versions["p-iteration"];
this.versions['solc'] = solcVersionInConfig; this.versions['solc'] = solcVersionInConfig;
this.versions['web3'] = web3VersionInConfig; this.versions['web3'] = web3VersionInConfig;
this.versions['ipfs-api'] = ipfsApiVersion; this.versions['ipfs-api'] = ipfsApiVersion;
this.versions['p-iteration'] = pIterationVersion;
Object.keys(this.versions).forEach(versionKey => { Object.keys(this.versions).forEach(versionKey => {
const newVersion = this.versions[versionKey].trim(); const newVersion = this.versions[versionKey].trim();
if (newVersion !== this.versions[versionKey]) { if (newVersion !== this.versions[versionKey]) {
this.embark.logger.warn(__('There a a space in the version of {{versionKey}}. We corrected it for you ({{correction}}).', {versionKey: versionKey, correction: `"${this.versions[versionKey]}" => "${newVersion}"`})); this.embark.logger.warn(__('There is a space in the version of {{versionKey}}. We corrected it for you ({{correction}}).', {versionKey: versionKey, correction: `"${this.versions[versionKey]}" => "${newVersion}"`}));
this.versions[versionKey] = newVersion; this.versions[versionKey] = newVersion;
} }
}); });

50
package-lock.json generated
View File

@ -1434,7 +1434,7 @@
"browserify-zlib": { "browserify-zlib": {
"version": "0.2.0", "version": "0.2.0",
"resolved": "https://registry.npmjs.org/browserify-zlib/-/browserify-zlib-0.2.0.tgz", "resolved": "https://registry.npmjs.org/browserify-zlib/-/browserify-zlib-0.2.0.tgz",
"integrity": "sha512-Z942RysHXmJrhqk88FmKBVq/v5tqmSkDz7p54G/MGyjMnCFFnC79XWNbg+Vta8W6Wb2qtSZTSxIGkJrRpCFEiA==", "integrity": "sha1-KGlFnZqjviRf6P4sofRuLn9U1z8=",
"requires": { "requires": {
"pako": "1.0.6" "pako": "1.0.6"
} }
@ -2466,7 +2466,7 @@
"domain-browser": { "domain-browser": {
"version": "1.2.0", "version": "1.2.0",
"resolved": "https://registry.npmjs.org/domain-browser/-/domain-browser-1.2.0.tgz", "resolved": "https://registry.npmjs.org/domain-browser/-/domain-browser-1.2.0.tgz",
"integrity": "sha512-jnjyiM6eRyZl2H+W8Q/zLMA481hzi0eszAaBUzIVnmYVDBbnLxVNnfu1HgEBvCbL+71FrxMl3E6lpKH7Ge3OXA==" "integrity": "sha1-PTH1AZGmdJ3RN1p/Ui6CPULlTto="
}, },
"drbg.js": { "drbg.js": {
"version": "1.0.1", "version": "1.0.1",
@ -2582,7 +2582,7 @@
"errno": { "errno": {
"version": "0.1.7", "version": "0.1.7",
"resolved": "https://registry.npmjs.org/errno/-/errno-0.1.7.tgz", "resolved": "https://registry.npmjs.org/errno/-/errno-0.1.7.tgz",
"integrity": "sha512-MfrRBDWzIWifgq6tJj60gkAwtLNb6sQPlcFrSOflcP1aFmmruKQ2wRnze/8V6kgyz7H3FF8Npzv78mZ7XLLflg==", "integrity": "sha1-RoTXF3mtOa8Xfj8AeZb3xnyFJhg=",
"requires": { "requires": {
"prr": "1.0.1" "prr": "1.0.1"
} }
@ -3243,7 +3243,7 @@
"resolved": "https://registry.npmjs.org/ethereumjs-testrpc/-/ethereumjs-testrpc-6.0.3.tgz", "resolved": "https://registry.npmjs.org/ethereumjs-testrpc/-/ethereumjs-testrpc-6.0.3.tgz",
"integrity": "sha1-eguHvzZw+S9gf5j6aniAHZdBsSQ=", "integrity": "sha1-eguHvzZw+S9gf5j6aniAHZdBsSQ=",
"requires": { "requires": {
"webpack": "3.12.0" "webpack": "3.11.0"
} }
}, },
"ethereumjs-tx": { "ethereumjs-tx": {
@ -6042,7 +6042,7 @@
"json-loader": { "json-loader": {
"version": "0.5.7", "version": "0.5.7",
"resolved": "https://registry.npmjs.org/json-loader/-/json-loader-0.5.7.tgz", "resolved": "https://registry.npmjs.org/json-loader/-/json-loader-0.5.7.tgz",
"integrity": "sha512-QLPs8Dj7lnf3e3QYS1zkCo+4ZwqOiF9d/nZnYozTISxXWCfNs9yuky5rJw4/W34s7POaNlbZmQGaB5NiXCbP4w==" "integrity": "sha1-3KFKcCNf+C8KyaOr62DTN6NlGF0="
}, },
"json-parse-better-errors": { "json-parse-better-errors": {
"version": "1.0.2", "version": "1.0.2",
@ -6470,7 +6470,7 @@
"lockfile": "1.0.4", "lockfile": "1.0.4",
"node-fetch": "2.1.2", "node-fetch": "2.1.2",
"semver": "5.5.0", "semver": "5.5.0",
"tar": "4.4.2", "tar": "4.4.4",
"url-join": "4.0.0" "url-join": "4.0.0"
}, },
"dependencies": { "dependencies": {
@ -6500,14 +6500,23 @@
"graceful-fs": "4.1.11" "graceful-fs": "4.1.11"
} }
}, },
"minipass": {
"version": "2.3.3",
"resolved": "https://registry.npmjs.org/minipass/-/minipass-2.3.3.tgz",
"integrity": "sha512-/jAn9/tEX4gnpyRATxgHEOV6xbcyxgT7iUnxo9Y3+OB0zX00TgKIv/2FZCf5brBbICcwbLqVv2ImjvWWrQMSYw==",
"requires": {
"safe-buffer": "5.1.2",
"yallist": "3.0.2"
}
},
"tar": { "tar": {
"version": "4.4.2", "version": "4.4.4",
"resolved": "https://registry.npmjs.org/tar/-/tar-4.4.2.tgz", "resolved": "https://registry.npmjs.org/tar/-/tar-4.4.4.tgz",
"integrity": "sha512-BfkE9CciGGgDsATqkikUHrQrraBCO+ke/1f6SFAEMnxyyfN9lxC+nW1NFWMpqH865DhHIy9vQi682gk1X7friw==", "integrity": "sha512-mq9ixIYfNF9SK0IS/h2HKMu8Q2iaCuhDDsZhdEag/FHv8fOaYld4vN7ouMgcSSt5WKZzPs8atclTcJm36OTh4w==",
"requires": { "requires": {
"chownr": "1.0.1", "chownr": "1.0.1",
"fs-minipass": "1.2.5", "fs-minipass": "1.2.5",
"minipass": "2.3.1", "minipass": "2.3.3",
"minizlib": "1.1.0", "minizlib": "1.1.0",
"mkdirp": "0.5.1", "mkdirp": "0.5.1",
"safe-buffer": "5.1.2", "safe-buffer": "5.1.2",
@ -7684,7 +7693,7 @@
"node-libs-browser": { "node-libs-browser": {
"version": "2.1.0", "version": "2.1.0",
"resolved": "https://registry.npmjs.org/node-libs-browser/-/node-libs-browser-2.1.0.tgz", "resolved": "https://registry.npmjs.org/node-libs-browser/-/node-libs-browser-2.1.0.tgz",
"integrity": "sha512-5AzFzdoIMb89hBGMZglEegffzgRg+ZFoUmisQ8HI4j1KDdpx13J0taNp2y9xPbur6W61gepGDDotGBVQ7mfUCg==", "integrity": "sha1-X5QmPUBPbkR2fXJpAf/wVHjWAN8=",
"requires": { "requires": {
"assert": "1.4.1", "assert": "1.4.1",
"browserify-zlib": "0.2.0", "browserify-zlib": "0.2.0",
@ -8057,7 +8066,7 @@
"os-locale": { "os-locale": {
"version": "2.1.0", "version": "2.1.0",
"resolved": "https://registry.npmjs.org/os-locale/-/os-locale-2.1.0.tgz", "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-2.1.0.tgz",
"integrity": "sha512-3sslG3zJbEYcaC4YVAvDorjGxc7tv6KVATnLPZONiljsUncvihe9BQoVCEs0RZ1kmf4Hk9OBqlZfJZWI4GanKA==", "integrity": "sha1-QrwpAKa1uL0XN2yOiCtlr8zyS/I=",
"requires": { "requires": {
"execa": "0.7.0", "execa": "0.7.0",
"lcid": "1.0.0", "lcid": "1.0.0",
@ -8079,6 +8088,11 @@
"resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz", "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz",
"integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=" "integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4="
}, },
"p-iteration": {
"version": "1.1.7",
"resolved": "https://registry.npmjs.org/p-iteration/-/p-iteration-1.1.7.tgz",
"integrity": "sha512-VsYvUPjm2edbKkX4QzlASC1qB2e4Z6IE9WPaRVHKwCtobmB6vfUcU9eBOwj1k5uMNi8O6w89QfsDatO5ePSjQg=="
},
"p-limit": { "p-limit": {
"version": "1.2.0", "version": "1.2.0",
"resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.2.0.tgz", "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.2.0.tgz",
@ -8121,7 +8135,7 @@
"pako": { "pako": {
"version": "1.0.6", "version": "1.0.6",
"resolved": "https://registry.npmjs.org/pako/-/pako-1.0.6.tgz", "resolved": "https://registry.npmjs.org/pako/-/pako-1.0.6.tgz",
"integrity": "sha512-lQe48YPsMJAig+yngZ87Lus+NF+3mtu7DVOBu6b/gHO1YpKwIj5AWjZ/TOS7i46HD/UixzWb1zeWDZfGZ3iYcg==" "integrity": "sha1-AQEhG6pwxLykoPY/Igbpe3368lg="
}, },
"parse-asn1": { "parse-asn1": {
"version": "5.1.1", "version": "5.1.1",
@ -11840,9 +11854,9 @@
"version": "github:dignifiedquire/webcrypto-shim#190bc9ec341375df6025b17ae12ddb2428ea49c8" "version": "github:dignifiedquire/webcrypto-shim#190bc9ec341375df6025b17ae12ddb2428ea49c8"
}, },
"webpack": { "webpack": {
"version": "3.12.0", "version": "3.11.0",
"resolved": "https://registry.npmjs.org/webpack/-/webpack-3.12.0.tgz", "resolved": "https://registry.npmjs.org/webpack/-/webpack-3.11.0.tgz",
"integrity": "sha512-Sw7MdIIOv/nkzPzee4o0EdvCuPmxT98+vVpIvwtcwcF1Q4SDSNp92vwcKc4REe7NItH9f1S4ra9FuQ7yuYZ8bQ==", "integrity": "sha1-d9pFGx17SxF62vQaGpO1dC8k2JQ=",
"requires": { "requires": {
"acorn": "5.5.3", "acorn": "5.5.3",
"acorn-dynamic-import": "2.0.2", "acorn-dynamic-import": "2.0.2",
@ -11910,7 +11924,7 @@
"webpack-sources": { "webpack-sources": {
"version": "1.1.0", "version": "1.1.0",
"resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-1.1.0.tgz", "resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-1.1.0.tgz",
"integrity": "sha512-aqYp18kPphgoO5c/+NaUvEeACtZjMESmDChuD3NBciVpah3XpMEU9VAAtIaB1BsfJWWTSdv8Vv1m3T0aRk2dUw==", "integrity": "sha1-oQHrrlnWUHNU1x2AE5UKOot6WlQ=",
"requires": { "requires": {
"source-list-map": "2.0.0", "source-list-map": "2.0.0",
"source-map": "0.6.1" "source-map": "0.6.1"
@ -11919,7 +11933,7 @@
"source-map": { "source-map": {
"version": "0.6.1", "version": "0.6.1",
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
"integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==" "integrity": "sha1-dHIq8y6WFOnCh6jQu95IteLxomM="
} }
} }
}, },

View File

@ -54,6 +54,7 @@
"merge": "^1.2.0", "merge": "^1.2.0",
"orbit-db": "^0.17.3", "orbit-db": "^0.17.3",
"os-locale": "^2.1.0", "os-locale": "^2.1.0",
"p-iteration": "^1.1.7",
"parse-json": "^4.0.0", "parse-json": "^4.0.0",
"promptly": "^2.1.0", "promptly": "^2.1.0",
"propose": "0.0.5", "propose": "0.0.5",

View File

@ -11,7 +11,8 @@
"versions": { "versions": {
"web3": "1.0.0-beta", "web3": "1.0.0-beta",
"solc": "0.4.23", "solc": "0.4.23",
"ipfs-api": "17.2.4" "ipfs-api": "17.2.4",
"p-iteration": "1.1.7"
}, },
"plugins": {} "plugins": {}
} }

View File

@ -10,7 +10,8 @@
"versions": { "versions": {
"web3": "1.0.0-beta", "web3": "1.0.0-beta",
"solc": "0.4.23", "solc": "0.4.23",
"ipfs-api": "17.2.4" "ipfs-api": "17.2.4",
"p-iteration": "1.1.7"
}, },
"plugins": { "plugins": {
} }

View File

@ -1,25 +1,39 @@
{ {
"default": { "default": {
"enabled": true, "enabled": true,
"available_providers": ["ipfs", "swarm"],
"ipfs_bin": "ipfs", "ipfs_bin": "ipfs",
"provider": "ipfs",
"host": "localhost", "available_providers": ["ipfs", "swarm"],
"port": 5001
"upload": {
"provider": "ipfs",
"host": "localhost",
"port": 5001
},
"dappConnection": [
"$BZZ",
{"provider": "swarm", "host": "localhost", "port": 8500, "getUrl": "http://localhost:8500/bzzr:/"},
{"provider": "ipfs", "host": "localhost", "port": 5001, "getUrl": "http://localhost:8080/ipfs/"}
]
}, },
"development": { "development": {
"enabled": true, "enabled": true,
"provider": "swarm", "upload": {
"host": "swarm-gateways.net", "provider": "ipfs",
"port": false, "host": "localhost",
"getUrl": "http://swarm-gateways.net/bzzr:/" "port": 5001,
"getUrl": "http://localhost:8080/ipfs/"
}
}, },
"livenet": { "livenet": {
"enabled": true, "enabled": true,
"provider": "ipfs", "upload":{
"host": "ipfs.infura.io", "provider": "ipfs",
"protocol": "https", "host": "ipfs.infura.io",
"port": false, "protocol": "https",
"getUrl": "https://ipfs.infura.io/ipfs/" "port": false,
"getUrl": "https://ipfs.infura.io/ipfs/"
}
} }
} }

View File

@ -17,7 +17,8 @@
"versions": { "versions": {
"solc": "0.4.18", "solc": "0.4.18",
"web3": "1.0.0-beta.34", "web3": "1.0.0-beta.34",
"ipfs-api": "17.2.7" "ipfs-api": "17.2.7",
"p-iteration": "1.1.7"
}, },
"plugins": { "plugins": {
"embark-service": {} "embark-service": {}