diff --git a/boilerplate/config/communication.json b/boilerplate/config/communication.json index 264cc646..07c7851a 100644 --- a/boilerplate/config/communication.json +++ b/boilerplate/config/communication.json @@ -1,6 +1,7 @@ { "default": { "enabled": true, - "provider": "whisper" + "provider": "whisper", + "available_providers": ["whisper", "orbit"] } } diff --git a/boilerplate/config/storage.json b/boilerplate/config/storage.json index 497227d9..f9516470 100644 --- a/boilerplate/config/storage.json +++ b/boilerplate/config/storage.json @@ -3,6 +3,7 @@ "enabled": true, "ipfs_bin": "ipfs", "provider": "ipfs", + "available_providers": ["ipfs"], "host": "localhost", "port": 5001 }, diff --git a/demo/config/communication.json b/demo/config/communication.json index 264cc646..07c7851a 100644 --- a/demo/config/communication.json +++ b/demo/config/communication.json @@ -1,6 +1,7 @@ { "default": { "enabled": true, - "provider": "whisper" + "provider": "whisper", + "available_providers": ["whisper", "orbit"] } } diff --git a/demo/config/storage.json b/demo/config/storage.json index 497227d9..f9516470 100644 --- a/demo/config/storage.json +++ b/demo/config/storage.json @@ -3,6 +3,7 @@ "enabled": true, "ipfs_bin": "ipfs", "provider": "ipfs", + "available_providers": ["ipfs"], "host": "localhost", "port": 5001 }, diff --git a/lib/core/config.js b/lib/core/config.js index 048c7f89..26e17246 100644 --- a/lib/core/config.js +++ b/lib/core/config.js @@ -114,6 +114,9 @@ Config.prototype.loadStorageConfigFile = function() { if (this.storageConfig.enabled === undefined) { this.storageConfig.enabled = true; } + if (this.storageConfig.available_providers === undefined) { + this.storageConfig.available_providers = []; + } }; Config.prototype.loadCommunicationConfigFile = function() { @@ -139,6 +142,9 @@ Config.prototype.loadCommunicationConfigFile = function() { if (this.communicationConfig.enabled === undefined) { this.communicationConfig.enabled = true; } + if (this.communicationConfig.available_providers === undefined) { + this.communicationConfig.available_providers = []; + } }; Config.prototype.loadEmbarkConfigFile = function() { @@ -181,15 +187,15 @@ Config.prototype.loadFiles = function(files) { }).filter(function(file) { if (file === 'embark.js') { - if (self.blockchainConfig.enabled || self.communicationConfig.provider === 'whisper') { + if (self.blockchainConfig.enabled || self.communicationConfig.provider === 'whisper' || self.communicationConfig.available_providers.indexOf('whisper') >= 0) { readFiles.push({filename: 'web3.js', content: fs.readFileSync(fs.embarkPath("js/web3.js")).toString(), path: fs.embarkPath("js/web3.js")}); } - if (self.storageConfig.enabled && self.storageConfig.provider === 'ipfs') { + if (self.storageConfig.enabled && (self.storageConfig.provider === 'ipfs' || self.storageConfig.available_providers.indexOf('ipfs') >= 0)) { readFiles.push({filename: 'ipfs.js', content: fs.readFileSync(fs.embarkPath("js/ipfs.js")).toString(), path: fs.embarkPath("js/ipfs.js")}); } - if (self.communicationConfig.enabled && self.communicationConfig.provider === 'orbit') { + if (self.communicationConfig.enabled && (self.communicationConfig.provider === 'orbit' || self.communicationConfig.available_providers.indexOf('orbit') >= 0)) { // TODO: remove duplicated files if functionality is the same for storage and orbit readFiles.push({filename: 'ipfs-api.js', content: fs.readFileSync(fs.embarkPath("js/ipfs-api.min.js")).toString(), path: fs.embarkPath("js/ipfs-api.min.js")}); readFiles.push({filename: 'orbit.js', content: fs.readFileSync(fs.embarkPath("js/orbit.min.js")).toString(), path: fs.embarkPath("js/orbit.min.js")}); diff --git a/test_app/config/communication.json b/test_app/config/communication.json index 264cc646..07c7851a 100644 --- a/test_app/config/communication.json +++ b/test_app/config/communication.json @@ -1,6 +1,7 @@ { "default": { "enabled": true, - "provider": "whisper" + "provider": "whisper", + "available_providers": ["whisper", "orbit"] } } diff --git a/test_app/config/storage.json b/test_app/config/storage.json index 497227d9..9d686457 100644 --- a/test_app/config/storage.json +++ b/test_app/config/storage.json @@ -1,6 +1,7 @@ { "default": { "enabled": true, + "available_providers": ["ipfs"], "ipfs_bin": "ipfs", "provider": "ipfs", "host": "localhost",