diff --git a/CHANGELOG.md b/CHANGELOG.md
index dd26e627..41b2cf19 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,13 @@
+
+# [0.31.0](https://github.com/ipfs/js-ipfsd-ctl/compare/v0.30.4...v0.31.0) (2018-03-27)
+
+
+### Features
+
+* upgrade to go-ipfs-0.4.14 ([77b4cd9](https://github.com/ipfs/js-ipfsd-ctl/commit/77b4cd9))
+
+
+
## [0.30.4](https://github.com/ipfs/js-ipfsd-ctl/compare/v0.30.3...v0.30.4) (2018-03-21)
diff --git a/README.md b/README.md
index 15e91240..546fed90 100644
--- a/README.md
+++ b/README.md
@@ -120,6 +120,7 @@ Spawn the daemon
- `start` bool (default true) - should the node be started
- `repoPath` string - the repository path to use for this node, ignored if node is disposable
- `disposable` bool (default true) - a new repo is created and initialized for each invocation, as well as cleaned up automatically once the process exits
+ - `defaultAddrs` bool (default false) - use the daemon default `Swarm` addrs
- `args` - array of cmd line arguments to be passed to ipfs daemon
- `config` - ipfs configuration options
diff --git a/package.json b/package.json
index 0778c87d..85f8469a 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "ipfsd-ctl",
- "version": "0.30.4",
+ "version": "0.31.0",
"description": "Spawn IPFS Daemons, JS or Go",
"main": "src/index.js",
"scripts": {
@@ -104,7 +104,7 @@
"cross-env": "^5.1.4",
"detect-port": "^1.2.2",
"dirty-chai": "^2.0.1",
- "go-ipfs-dep": "0.4.13",
+ "go-ipfs-dep": "0.4.14",
"ipfs": "~0.28.2",
"is-running": "1.0.5",
"mkdirp": "^0.5.1",
diff --git a/src/factory-daemon.js b/src/factory-daemon.js
index 53391421..5c08d97a 100644
--- a/src/factory-daemon.js
+++ b/src/factory-daemon.js
@@ -79,6 +79,7 @@ class FactoryDaemon {
* - `start` bool - should the node be started
* - `repoPath` string - the repository path to use for this node, ignored if node is disposable
* - `disposable` bool - a new repo is created and initialized for each invocation
+ * - `defaultAddrs` bool (default false) - use the daemon default `Swarm` addrs
* - `config` - ipfs configuration options
* - `args` - array of cmd line arguments to be passed to ipfs daemon
* - `exec` string (optional) - path to the desired IPFS executable to spawn,
@@ -104,9 +105,6 @@ class FactoryDaemon {
if (!options.disposable) {
const nonDisposableConfig = clone(defaultConfig)
- // TODO Why delete these?
- // delete nonDisposableConfig.Addresses
-
options.init = false
options.start = false
@@ -124,6 +122,10 @@ class FactoryDaemon {
options.config = defaultsDeep({}, options.config, defaultConfig)
}
+ if (options.defaultAddrs) {
+ delete options.config.Addresses
+ }
+
options.type = this.type
options.exec = options.exec || this.exec
diff --git a/src/factory-in-proc.js b/src/factory-in-proc.js
index 1a3e897d..73ac9218 100644
--- a/src/factory-in-proc.js
+++ b/src/factory-in-proc.js
@@ -76,11 +76,12 @@ class FactoryInProc {
* Spawn JSIPFS instances
*
* Options are:
- * - `init` {bool|Object} - should the node be initialized
+ * - `init` bool - should the node be initialized
* - `initOptions` Object, it is expected to be of the form `{bits: }`, which sets the desired key size
* - `start` bool - should the node be started
* - `repoPath` string - the repository path to use for this node, ignored if node is disposable
* - `disposable` bool - a new repo is created and initialized for each invocation
+ * - `defaultAddrs` bool (default false) - use the daemon default `Swarm` addrs
* - `config` - ipfs configuration options
* - `args` - array of cmd line arguments to be passed to ipfs daemon
* - `exec` string (optional) - path to the desired IPFS executable to spawn,
@@ -105,9 +106,6 @@ class FactoryInProc {
options.config = defaults({}, options.config, defaultConfig)
} else {
const nonDisposableConfig = clone(defaultConfig)
- // TODO why delete the addrs here???
- // delete nonDisposableConfig.Addresses
-
options.init = false
options.start = false
@@ -120,6 +118,10 @@ class FactoryInProc {
options.config = defaults({}, options.config, nonDisposableConfig)
}
+ if (options.defaultAddrs) {
+ delete options.config.Addresses
+ }
+
options.type = this.type
options.exec = options.exec || this.exec
diff --git a/test/spawn-options.spec.js b/test/spawn-options.spec.js
index 7cb3c0f8..8228d96d 100644
--- a/test/spawn-options.spec.js
+++ b/test/spawn-options.spec.js
@@ -186,6 +186,50 @@ describe('Spawn options', function () {
})
})
+ // TODO re-enable when jenkins runs tests in isolation
+ describe.skip('spawn with default swarm addrs', () => {
+ const addrs = {
+ go: [
+ '/ip4/0.0.0.0/tcp/4001',
+ '/ip6/::/tcp/4001'
+ ],
+ js: [
+ '/ip4/0.0.0.0/tcp/4002',
+ '/ip4/127.0.0.1/tcp/4003/ws'
+ ],
+ proc: [
+ '/ip4/0.0.0.0/tcp/4002',
+ '/ip4/127.0.0.1/tcp/4003/ws'
+ ]
+ }
+
+ it('swarm contains default addrs', function (done) {
+ this.timeout(20 * 1000)
+
+ if (!isNode && fOpts.type === 'proc') {
+ this.skip()
+ }
+
+ f.spawn({
+ defaultAddrs: true,
+ initOptions: {
+ bits: fOpts.bits
+ }
+ }, (err, ipfsd) => {
+ expect(err).to.not.exist()
+ ipfsd.getConfig('Addresses.Swarm', (err, config) => {
+ expect(err).to.not.exist()
+ if (fOpts.type !== 'proc') {
+ config = JSON.parse(config)
+ }
+
+ expect(config).to.deep.equal(addrs[fOpts.type])
+ ipfsd.stop(done)
+ })
+ })
+ })
+ })
+
describe('custom config options', () => {
it('custom config', function (done) {
this.timeout(50 * 1000)
diff --git a/test/start-stop.node.js b/test/start-stop.node.js
index 72590d3c..0ec55814 100644
--- a/test/start-stop.node.js
+++ b/test/start-stop.node.js
@@ -141,7 +141,7 @@ tests.forEach((fOpts) => {
ipfsd.start(['--should-not-exist'], (err) => {
expect(err).to.exist()
expect(err.message)
- .to.match(/Unrecognized option 'should-not-exist'/)
+ .to.match(/unknown option "should-not-exist"\n/)
done()
})