Skip to content
This repository was archived by the owner on Feb 12, 2024. It is now read-only.

Commit d188a66

Browse files
committed
adapted to new ipfs-repo API
1 parent fcef848 commit d188a66

File tree

5 files changed

+6
-31
lines changed

5 files changed

+6
-31
lines changed

package.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,6 @@
115115
"libp2p-ipfs-nodejs": "~0.25.2",
116116
"lodash.flatmap": "^4.5.0",
117117
"lodash.get": "^4.4.2",
118-
"lodash.has": "^4.5.2",
119-
"lodash.set": "^4.3.2",
120118
"lodash.sortby": "^4.7.0",
121119
"lodash.values": "^4.3.0",
122120
"mafmt": "^2.1.8",

src/core/components/config.js

Lines changed: 3 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
'use strict'
22

33
const promisify = require('promisify-es6')
4-
const _get = require('lodash.get')
5-
const _has = require('lodash.has')
6-
const _set = require('lodash.set')
74

85
module.exports = function config (self) {
96
return {
@@ -15,23 +12,9 @@ module.exports = function config (self) {
1512

1613
if (!key) {
1714
return self._repo.config.get(callback)
15+
} else {
16+
return self._repo.config.get(key, callback)
1817
}
19-
20-
if (typeof key !== 'string') {
21-
return callback(new Error('Invalid key type'))
22-
}
23-
24-
self._repo.config.get((err, config) => {
25-
if (err) {
26-
return callback(err)
27-
}
28-
if (_has(config, key)) {
29-
const value = _get(config, key, undefined)
30-
callback(null, value)
31-
} else {
32-
callback(new Error('Key does not exist in config'))
33-
}
34-
})
3518
}),
3619
set: promisify((key, value, callback) => {
3720
if (!key || typeof key !== 'string') {
@@ -42,13 +25,7 @@ module.exports = function config (self) {
4225
return callback(new Error('Invalid value type'))
4326
}
4427

45-
self._repo.config.get((err, config) => {
46-
if (err) {
47-
return callback(err)
48-
}
49-
_set(config, key, value)
50-
self.config.replace(config, callback)
51-
})
28+
self._repo.config.set(key, value, callback)
5229
}),
5330
replace: promisify((config, callback) => {
5431
self._repo.config.set(config, callback)

src/core/components/dht.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ module.exports = (self) => {
116116

117117
// ensure blocks are actually local
118118
every(keys, (key, cb) => {
119-
self._repo.blockstore.has(key, cb)
119+
self._repo.blocks.has(key, cb)
120120
}, (err, has) => {
121121
if (err) {
122122
return callback(err)

src/core/components/start.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ module.exports = (self) => {
4343

4444
self._bitswap = new Bitswap(
4545
self._libp2pNode,
46-
self._repo.blockstore,
46+
self._repo.blocks,
4747
self._peerInfoBook
4848
)
4949

src/http-api/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ function HttpApi (repo, config) {
114114
console.log('Gateway (readonly) is listening on: %s', gateway.info.ma)
115115

116116
// for the CLI to know the where abouts of the API
117-
this.node._repo.setApiAddress(api.info.ma, cb)
117+
this.node._repo.apiAddr.set(api.info.ma, cb)
118118
}
119119
], (err) => {
120120
this.log('done', err)

0 commit comments

Comments
 (0)