Skip to content

Commit

Permalink
feat: support for passphrase for js-ipfs daemons
Browse files Browse the repository at this point in the history
  • Loading branch information
richardschneider authored and daviddias committed Jan 27, 2018
1 parent 5bdbb67 commit 3bc94c1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
14 changes: 12 additions & 2 deletions src/in-proc-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,22 @@ class Node {
}
})

this.opts.EXPERIMENTAL.pubsub = (this.opts.args.indexOf('--enable-pubsub-experiment') > -1)
this.opts.EXPERIMENTAL.sharding = (this.opts.args.indexOf('--enable-sharding-experiment') > -1)
this.opts.args.forEach((arg) => {
if (arg === '--enable-pubsub-experiment') {
this.opts.EXPERIMENTAL.pubsub = true
} else if (arg === '--enable-sharding-experiment') {
this.opts.EXPERIMENTAL.sharding = true
} else if (arg.startsWith('--pass')) {
this.opts.pass = arg.split(' ').slice(1).join(' ')
} else {
throw new Error('Unkown argument ' + arg)
}
})
this.exec = new IPFS({
repo: this.repo,
init: false,
start: false,
pass: this.opts.pass,
EXPERIMENTAL: this.opts.EXPERIMENTAL,
libp2p: this.opts.libp2p
})
Expand Down
2 changes: 1 addition & 1 deletion src/utils/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ exports.findIpfsExecutable = (type, rootPath) => {

function run (node, args, opts, callback) {
let executable = node.exec
if (isWindows && node.opts.type !== 'go') {
if (isWindows && executable.endsWith('.js')) {
args = args || []
args.unshift(node.exec)
executable = process.execPath
Expand Down

0 comments on commit 3bc94c1

Please sign in to comment.