-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add keysize through an option to spawn #203
Changes from 1 commit
2595fc4
718e0ce
c9c25da
c3fca62
55142c5
17d578e
f5f400e
ee74427
b167a3c
ac70cda
6c7a028
2ca9aa1
1351dde
fb30e0e
174e9dc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,7 +35,7 @@ class Node { | |
this._started = false | ||
this.initialized = false | ||
this.api = null | ||
this.bits = process.env.IPFS_KEYSIZE || (this.opts.initOptions ? this.opts.initOptions.bits : null) | ||
this.bits = this.opts.initOptions ? this.opts.initOptions.bits : null | ||
|
||
this.opts.EXPERIMENTAL = defaultsDeep({}, opts.EXPERIMENTAL, { | ||
pubsub: false, | ||
|
@@ -126,7 +126,7 @@ class Node { | |
* @returns {undefined} | ||
*/ | ||
init (initOptions, callback) { | ||
if (!callback) { | ||
if (typeof initOptions === 'function') { | ||
callback = initOptions | ||
initOptions = {} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as above. |
||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,8 +11,8 @@ const IPFSFactory = require('../src') | |
const JSIPFS = require('ipfs') | ||
|
||
const tests = [ | ||
{ type: 'go' }, | ||
{ type: 'js' }, | ||
{ type: 'go', bits: 1024 }, | ||
{ type: 'js', bits: 512 }, | ||
{ type: 'proc', exec: JSIPFS } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't forget about his one. |
||
] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The proc node also should receive the bits. |
||
|
||
|
@@ -21,13 +21,11 @@ describe('data can be put and fetched', () => { | |
let ipfsd | ||
|
||
before(function (done) { | ||
this.timeout(30 * 1000) | ||
this.timeout(20 * 1000) | ||
|
||
const f = IPFSFactory.create(dfOpts) | ||
|
||
f.spawn({ | ||
initOptions: { bits: 1024 } | ||
}, (err, _ipfsd) => { | ||
f.spawn({ initOptions: { bits: dfOpts.bits } }, (err, _ipfsd) => { | ||
expect(err).to.not.exist() | ||
expect(_ipfsd).to.exist() | ||
expect(_ipfsd.api).to.exist() | ||
|
@@ -39,12 +37,12 @@ describe('data can be put and fetched', () => { | |
}) | ||
|
||
after(function (done) { | ||
this.timeout(30 * 1000) | ||
this.timeout(20 * 1000) | ||
ipfsd.stop(done) | ||
}) | ||
|
||
it('put and fetch a block', function (done) { | ||
this.timeout(30 * 1000) | ||
this.timeout(20 * 1000) | ||
|
||
const data = Buffer.from('blorb') | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this mean that is mandatory to always pass a initOptions object? There should be a check to see if initOptions is a func.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we're checking for
!callback
which is not consistent with how do it elsewhere (leftover from prev codebase), I'll change it. Good catch.