Skip to content
This repository has been archived by the owner on Mar 10, 2020. It is now read-only.

Commit

Permalink
fix: config get (#825)
Browse files Browse the repository at this point in the history
* fix: config get

* chore: update interface-ipfs-core dep

License: MIT
Signed-off-by: Alan Shaw <alan@tableflip.io>

* chore: temporarily skip resolve tests (not implemented yet)

License: MIT
Signed-off-by: Alan Shaw <alan@tableflip.io>
  • Loading branch information
hacdias authored and alanshaw committed Aug 6, 2018
1 parent 80452eb commit ef5a4a3
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
"eslint-plugin-react": "^7.10.0",
"go-ipfs-dep": "~0.4.17",
"gulp": "^3.9.1",
"interface-ipfs-core": "~0.73.0",
"interface-ipfs-core": "~0.75.0",
"ipfsd-ctl": "~0.39.0",
"pull-stream": "^3.6.8",
"socket.io": "^2.1.1",
Expand Down
16 changes: 12 additions & 4 deletions src/config/get.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@

const promisify = require('promisify-es6')

const toObject = function (res, callback) {
if (Buffer.isBuffer(res)) {
callback(null, JSON.parse(res.toString()))
} else {
callback(null, res)
}
}

module.exports = (send) => {
return promisify((key, callback) => {
if (typeof key === 'function') {
Expand All @@ -10,18 +18,18 @@ module.exports = (send) => {
}

if (!key) {
send({
send.andTransform({
path: 'config/show',
buffer: true
}, callback)
}, toObject, callback)
return
}

send({
send.andTransform({
path: 'config',
args: key,
buffer: true
}, (err, response) => {
}, toObject, (err, response) => {
if (err) {
return callback(err)
}
Expand Down
4 changes: 3 additions & 1 deletion test/interface.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,9 @@ describe('interface-ipfs-core tests', () => {
{
name: 'should stop the node',
reason: 'FIXME go-ipfs returns an error https://github.com/ipfs/go-ipfs/issues/4078'
}
},
// resolve
'resolve'
]
})

Expand Down

0 comments on commit ef5a4a3

Please sign in to comment.