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

Commit ef5a4a3

Browse files
hacdiasalanshaw
authored andcommitted
fix: config get (#825)
* 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>
1 parent 80452eb commit ef5a4a3

File tree

3 files changed

+16
-6
lines changed

3 files changed

+16
-6
lines changed

Diff for: package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
"eslint-plugin-react": "^7.10.0",
8181
"go-ipfs-dep": "~0.4.17",
8282
"gulp": "^3.9.1",
83-
"interface-ipfs-core": "~0.73.0",
83+
"interface-ipfs-core": "~0.75.0",
8484
"ipfsd-ctl": "~0.39.0",
8585
"pull-stream": "^3.6.8",
8686
"socket.io": "^2.1.1",

Diff for: src/config/get.js

+12-4
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22

33
const promisify = require('promisify-es6')
44

5+
const toObject = function (res, callback) {
6+
if (Buffer.isBuffer(res)) {
7+
callback(null, JSON.parse(res.toString()))
8+
} else {
9+
callback(null, res)
10+
}
11+
}
12+
513
module.exports = (send) => {
614
return promisify((key, callback) => {
715
if (typeof key === 'function') {
@@ -10,18 +18,18 @@ module.exports = (send) => {
1018
}
1119

1220
if (!key) {
13-
send({
21+
send.andTransform({
1422
path: 'config/show',
1523
buffer: true
16-
}, callback)
24+
}, toObject, callback)
1725
return
1826
}
1927

20-
send({
28+
send.andTransform({
2129
path: 'config',
2230
args: key,
2331
buffer: true
24-
}, (err, response) => {
32+
}, toObject, (err, response) => {
2533
if (err) {
2634
return callback(err)
2735
}

Diff for: test/interface.spec.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,9 @@ describe('interface-ipfs-core tests', () => {
174174
{
175175
name: 'should stop the node',
176176
reason: 'FIXME go-ipfs returns an error https://github.com/ipfs/go-ipfs/issues/4078'
177-
}
177+
},
178+
// resolve
179+
'resolve'
178180
]
179181
})
180182

0 commit comments

Comments
 (0)