mirror of https://github.com/embarklabs/embark.git
fix(@embark/storage): Allow upload when storage disabled
Allow `embark upload` to upload to IPFS/Swarm even if the storage module is disabled in the storage config. An easy way to test this is to set `config/storage.js` > `enabled` to `false` in the demo. Then run `embark upload`.
This commit is contained in:
parent
c233dbc7fb
commit
9ea0383046
|
@ -3,6 +3,7 @@ const utils = require('../../utils/utils.js');
|
||||||
const IpfsApi = require('ipfs-api');
|
const IpfsApi = require('ipfs-api');
|
||||||
// TODO: not great, breaks module isolation
|
// TODO: not great, breaks module isolation
|
||||||
const StorageProcessesLauncher = require('../storage/storageProcessesLauncher');
|
const StorageProcessesLauncher = require('../storage/storageProcessesLauncher');
|
||||||
|
const constants = require('../../constants.json');
|
||||||
|
|
||||||
class IPFS {
|
class IPFS {
|
||||||
|
|
||||||
|
@ -196,11 +197,13 @@ class IPFS {
|
||||||
|
|
||||||
isIpfsStorageEnabledInTheConfig() {
|
isIpfsStorageEnabledInTheConfig() {
|
||||||
let {enabled, available_providers, dappConnection, upload} = this.storageConfig;
|
let {enabled, available_providers, dappConnection, upload} = this.storageConfig;
|
||||||
return enabled &&
|
return (enabled || this.embark.currentContext.includes(constants.contexts.upload)) &&
|
||||||
|
(
|
||||||
available_providers.includes('ipfs') &&
|
available_providers.includes('ipfs') &&
|
||||||
(
|
(
|
||||||
dappConnection.some(c => c.provider === 'ipfs') ||
|
dappConnection.some(c => c.provider === 'ipfs') ||
|
||||||
upload.provider === 'ipfs'
|
upload.provider === 'ipfs'
|
||||||
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -164,7 +164,7 @@ class Swarm {
|
||||||
|
|
||||||
isSwarmEnabledInTheConfig() {
|
isSwarmEnabledInTheConfig() {
|
||||||
let {enabled, available_providers, dappConnection, upload} = this.storageConfig;
|
let {enabled, available_providers, dappConnection, upload} = this.storageConfig;
|
||||||
return enabled &&
|
return (enabled || this.embark.currentContext.includes(constants.contexts.upload)) &&
|
||||||
available_providers.includes('swarm') &&
|
available_providers.includes('swarm') &&
|
||||||
(
|
(
|
||||||
dappConnection.some(c => c.provider === 'swarm') ||
|
dappConnection.some(c => c.provider === 'swarm') ||
|
||||||
|
|
Loading…
Reference in New Issue