From 5fb5c96e2c34f8e6e6d9dbcd71e502d6217a5fca Mon Sep 17 00:00:00 2001 From: Johannes Date: Tue, 18 Jul 2017 16:43:25 +0200 Subject: [PATCH 1/2] Fix js-ipfs daemon config params - Respect `--enable-experimental-pubsub` - Don't overload repo config with cli args (fixes #868) - Typo --- src/cli/commands/daemon.js | 2 +- src/http-api/index.js | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/cli/commands/daemon.js b/src/cli/commands/daemon.js index 9d4788657c..10321c2a37 100644 --- a/src/cli/commands/daemon.js +++ b/src/cli/commands/daemon.js @@ -16,7 +16,7 @@ module.exports = { default: false }, 'enable-pubsub-experiment': { - type: 'booleam', + type: 'boolean', default: false } }, diff --git a/src/http-api/index.js b/src/http-api/index.js index 5746979b83..0e8f573342 100644 --- a/src/http-api/index.js +++ b/src/http-api/index.js @@ -53,9 +53,8 @@ function HttpApi (repo, config) { repo: repo, init: init, start: true, - config: config, EXPERIMENTAL: { - pubsub: true, + pubsub: config && config.enablePubsubExperiment, sharding: config && config.enableShardingExperiment }, libp2p: libp2p From 4d86ae197f6167f440e1c04209cef58da9cdac04 Mon Sep 17 00:00:00 2001 From: Johannes Date: Wed, 19 Jul 2017 15:39:56 +0200 Subject: [PATCH 2/2] Treat cli args and config overload as seperate - Add an extra parameter for `HttpAPI` for `cliArgs` --- src/cli/commands/daemon.js | 2 +- src/http-api/index.js | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/cli/commands/daemon.js b/src/cli/commands/daemon.js index 10321c2a37..67a590956b 100644 --- a/src/cli/commands/daemon.js +++ b/src/cli/commands/daemon.js @@ -25,7 +25,7 @@ module.exports = { console.log('Initializing daemon...') const repoPath = utils.getRepoPath() - httpAPI = new HttpAPI(process.env.IPFS_PATH, argv) + httpAPI = new HttpAPI(process.env.IPFS_PATH, null, argv) httpAPI.start((err) => { if (err && err.code === 'ENOENT' && err.message.match(/Uninitalized repo/i)) { diff --git a/src/http-api/index.js b/src/http-api/index.js index 0e8f573342..a0d849e9d2 100644 --- a/src/http-api/index.js +++ b/src/http-api/index.js @@ -16,7 +16,7 @@ function uriToMultiaddr (uri) { return `/ip4/${ipPort[0]}/tcp/${ipPort[1]}` } -function HttpApi (repo, config) { +function HttpApi (repo, config, cliArgs) { this.node = undefined this.server = undefined @@ -53,9 +53,10 @@ function HttpApi (repo, config) { repo: repo, init: init, start: true, + config: config, EXPERIMENTAL: { - pubsub: config && config.enablePubsubExperiment, - sharding: config && config.enableShardingExperiment + pubsub: cliArgs && cliArgs.enablePubsubExperiment, + sharding: cliArgs && cliArgs.enableShardingExperiment }, libp2p: libp2p })