diff --git a/lib/processes/storageProcesses/ipfs.js b/lib/processes/storageProcesses/ipfs.js index 00488a648..724a47724 100644 --- a/lib/processes/storageProcesses/ipfs.js +++ b/lib/processes/storageProcesses/ipfs.js @@ -1,7 +1,6 @@ const child_process = require('child_process'); const ProcessWrapper = require('../processWrapper'); const constants = require('../../constants'); -const StorageUtils = require('./storageUtils'); let ipfsProcess; // eslint-disable-line no-unused-vars @@ -10,7 +9,7 @@ class IPFSProcess extends ProcessWrapper { super(); this.cors = options.cors; - this.command = StorageUtils.getCommand('ipfs', options); + this.command = 'ipfs'; this.checkIPFSVersion(); this.startIPFSDaemon(); diff --git a/lib/processes/storageProcesses/storageProcessesLauncher.js b/lib/processes/storageProcesses/storageProcessesLauncher.js index 0e1cc1c9b..6e7b23593 100644 --- a/lib/processes/storageProcesses/storageProcessesLauncher.js +++ b/lib/processes/storageProcesses/storageProcessesLauncher.js @@ -3,9 +3,13 @@ const shellJs = require('shelljs'); const utils = require('../../utils/utils'); const ProcessLauncher = require('../processLauncher'); const constants = require('../../constants'); -const StorageUtils = require('./storageUtils'); const {canonicalHost} = require('../../utils/host'); +let References = { + ipfs: 'https://ipfs.io/docs/install/', + swarm: 'http://swarm-guide.readthedocs.io/en/latest/installation.html' +} + class StorageProcessesLauncher { constructor(options) { this.logger = options.logger; @@ -89,10 +93,12 @@ class StorageProcessesLauncher { return callback(__('No process file for this storage type (%s) exists. Please start the process locally.', storageName)); } - const program = shellJs.which(StorageUtils.getCommand(storageName, self.storageConfig)); + let cmd = (storageName === 'swarm' ? (self.storageConfig.swarmPath || 'swarm') : 'ipfs'); + + const program = shellJs.which(cmd); if (!program) { self.logger.warn(__('{{storageName}} is not installed or your configuration is not right', {storageName}).yellow); - self.logger.info(__('You can install and get more information here: ').yellow + StorageUtils.getStorageInstallationSite(storageName).underline); + self.logger.info(__('You can install and get more information here: ').yellow + References[storageName].underline); return callback(__('%s not installed', storageName)); } diff --git a/lib/processes/storageProcesses/storageUtils.js b/lib/processes/storageProcesses/storageUtils.js deleted file mode 100644 index d701d2b73..000000000 --- a/lib/processes/storageProcesses/storageUtils.js +++ /dev/null @@ -1,25 +0,0 @@ -const IPFS = 'ipfs'; -const SWARM = 'swarm'; - -class StorageUtils { - static getCommand(storageName, config) { - if (storageName === IPFS) { - return IPFS; - } - if (storageName === SWARM) { - return config.swarmPath || SWARM; - } - return null; - } - - static getStorageInstallationSite(storageName) { - if (storageName === IPFS) { - return 'https://ipfs.io/docs/install/'; - } - if (storageName === SWARM) { - return 'http://swarm-guide.readthedocs.io/en/latest/installation.html'; - } - } -} - -module.exports = StorageUtils; diff --git a/lib/processes/storageProcesses/swarm.js b/lib/processes/storageProcesses/swarm.js index a5236f36a..ac0ca9bb9 100644 --- a/lib/processes/storageProcesses/swarm.js +++ b/lib/processes/storageProcesses/swarm.js @@ -2,7 +2,6 @@ const child_process = require('child_process'); const ProcessWrapper = require('../processWrapper'); const constants = require('../../constants'); const fs = require('../../core/fs'); -const StorageUtils = require('./storageUtils'); let swarmProcess; @@ -11,7 +10,7 @@ class SwarmProcess extends ProcessWrapper { super(); this.storageConfig = options.storageConfig; this.cors = options.cors; - this.command = StorageUtils.getCommand('swarm', this.storageConfig); + this.command = this.storageConfig.swarmPath || 'swarm'; } startSwarmDaemon() {