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

Commit

Permalink
fix: get correct remote node config
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
achingbrain committed Oct 3, 2019
1 parent 55e64d4 commit 5b53e22
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
7 changes: 3 additions & 4 deletions src/add-from-fs/index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
'use strict'

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

module.exports = configure(({ ky }) => {
const add = require('../add')({ ky })
module.exports = (config) => {
const add = require('../add')(config)
return (path, options) => add(globSource(path, options), options)
})
}
7 changes: 3 additions & 4 deletions src/add-from-url.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
'use strict'

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

module.exports = configure(({ ky }) => {
const add = require('./add')({ ky })
module.exports = (config) => {
const add = require('./add')(config)

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

yield * add(input, options)
})()
})
}
5 changes: 3 additions & 2 deletions src/pubsub/subscribe.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ const configure = require('../lib/configure')
const toIterable = require('../lib/stream-to-iterable')
const SubscriptionTracker = require('./subscription-tracker')

module.exports = configure(({ ky }) => {
module.exports = configure((config) => {
const ky = config.ky
const subsTracker = SubscriptionTracker.singleton()
const publish = require('./publish')({ ky })
const publish = require('./publish')(config)

return async (topic, handler, options) => {
options = options || {}
Expand Down

0 comments on commit 5b53e22

Please sign in to comment.