Skip to content

Commit

Permalink
fix: pass config to init
Browse files Browse the repository at this point in the history
  • Loading branch information
hugomrdias committed Oct 24, 2018
1 parent 6f396cb commit 9c8997c
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions src/ipfsd-daemon.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,10 @@ class Daemon {
}

const bits = initOptions.bits || this.bits
const args = ['init']
const args = [
'init',
this.opts.type === 'js' && JSON.stringify(this.opts.config)
].filter(Boolean)
// do not just set a default keysize,
// in case we decide to change it at
// the daemon level in the future
Expand All @@ -174,14 +177,22 @@ class Daemon {
args.push('--pass')
args.push('"' + initOptions.pass + '"')
}
run(this, args, { env: this.env }, (err, result) => {
run(this, args, { stdout: data => console.log(data.toString()), env: this.env }, (err, result) => {
if (err) {
return callback(err)
}

if (this.opts.type === 'js') {
this.clean = false
this.initialized = true
return callback(null, this)
}

waterfall([
(cb) => this.getConfig(cb),
(conf, cb) => this.replaceConfig(defaults({}, this.opts.config, conf), cb)
(conf, cb) => {
this.replaceConfig(defaults({}, this.opts.config, conf), cb)
}
], (err) => {
if (err) { return callback(err) }
this.clean = false
Expand Down

0 comments on commit 9c8997c

Please sign in to comment.