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

Commit

Permalink
fix: config set with number (#998)
Browse files Browse the repository at this point in the history
Anything that isn't a string needs to be passed with `--json`.

fixes #881

Depends on:

* [x] ipfs-inactive/interface-js-ipfs-core#470

License: MIT
Signed-off-by: Alan Shaw <[email protected]>
  • Loading branch information
Alan Shaw authored May 15, 2019
1 parent 7a47e3b commit 4f21bef
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
"dirty-chai": "^2.0.1",
"eslint-plugin-react": "^7.11.1",
"go-ipfs-dep": "0.4.19",
"interface-ipfs-core": "~0.100.1",
"interface-ipfs-core": "~0.101.0",
"ipfsd-ctl": "~0.42.0",
"nock": "^10.0.2",
"stream-equal": "^1.1.1"
Expand Down
8 changes: 3 additions & 5 deletions src/config/set.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,12 @@ module.exports = (send) => {
return callback(new Error('Invalid value type'))
}

if (typeof value === 'object') {
value = JSON.stringify(value)
opts = { json: true }
}

if (typeof value === 'boolean') {
value = value.toString()
opts = { bool: true }
} else if (typeof value !== 'string') {
value = JSON.stringify(value)
opts = { json: true }
}

send({
Expand Down

0 comments on commit 4f21bef

Please sign in to comment.