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

Commit 5b53e22

Browse files
committed
fix: get correct remote node config
I noticed some calls would fail during tests when the daemon was listening on non-standard ports, this was because when commands `require` other commands that use `ky`, we are passing the `ky` instance in as the sole property of an object that usually contains the host and port number of the remote node's API server.
1 parent 55e64d4 commit 5b53e22

File tree

3 files changed

+9
-10
lines changed

3 files changed

+9
-10
lines changed

src/add-from-fs/index.js

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

3-
const configure = require('../lib/configure')
43
const globSource = require('ipfs-utils/src/files/glob-source')
54

6-
module.exports = configure(({ ky }) => {
7-
const add = require('../add')({ ky })
5+
module.exports = (config) => {
6+
const add = require('../add')(config)
87
return (path, options) => add(globSource(path, options), options)
9-
})
8+
}

src/add-from-url.js

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

33
const kyDefault = require('ky-universal').default
4-
const configure = require('./lib/configure')
54
const toIterable = require('./lib/stream-to-iterable')
65

7-
module.exports = configure(({ ky }) => {
8-
const add = require('./add')({ ky })
6+
module.exports = (config) => {
7+
const add = require('./add')(config)
98

109
return (url, options) => (async function * () {
1110
options = options || {}
@@ -19,4 +18,4 @@ module.exports = configure(({ ky }) => {
1918

2019
yield * add(input, options)
2120
})()
22-
})
21+
}

src/pubsub/subscribe.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,10 @@ const configure = require('../lib/configure')
99
const toIterable = require('../lib/stream-to-iterable')
1010
const SubscriptionTracker = require('./subscription-tracker')
1111

12-
module.exports = configure(({ ky }) => {
12+
module.exports = configure((config) => {
13+
const ky = config.ky
1314
const subsTracker = SubscriptionTracker.singleton()
14-
const publish = require('./publish')({ ky })
15+
const publish = require('./publish')(config)
1516

1617
return async (topic, handler, options) => {
1718
options = options || {}

0 commit comments

Comments
 (0)