add config to specify available providers for each component
This commit is contained in:
parent
09e58977e4
commit
1674adee4a
|
@ -1,6 +1,7 @@
|
|||
{
|
||||
"default": {
|
||||
"enabled": true,
|
||||
"provider": "whisper"
|
||||
"provider": "whisper",
|
||||
"available_providers": ["whisper", "orbit"]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
"enabled": true,
|
||||
"ipfs_bin": "ipfs",
|
||||
"provider": "ipfs",
|
||||
"available_providers": ["ipfs"],
|
||||
"host": "localhost",
|
||||
"port": 5001
|
||||
},
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
{
|
||||
"default": {
|
||||
"enabled": true,
|
||||
"provider": "whisper"
|
||||
"provider": "whisper",
|
||||
"available_providers": ["whisper", "orbit"]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
"enabled": true,
|
||||
"ipfs_bin": "ipfs",
|
||||
"provider": "ipfs",
|
||||
"available_providers": ["ipfs"],
|
||||
"host": "localhost",
|
||||
"port": 5001
|
||||
},
|
||||
|
|
|
@ -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")});
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
{
|
||||
"default": {
|
||||
"enabled": true,
|
||||
"provider": "whisper"
|
||||
"provider": "whisper",
|
||||
"available_providers": ["whisper", "orbit"]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
{
|
||||
"default": {
|
||||
"enabled": true,
|
||||
"available_providers": ["ipfs"],
|
||||
"ipfs_bin": "ipfs",
|
||||
"provider": "ipfs",
|
||||
"host": "localhost",
|
||||
|
|
Loading…
Reference in New Issue