Skip to content

Commit 2a6f984

Browse files
committed
fix: only require http api client if it has not been specified
If we configure which http api module to use, don't try to require `ipfs-http-client`, because that then means the containing project needs to specify a dependency on `ipfs-http-client` when the containing project might actually be `ipfs-http-client`...
1 parent ffbe377 commit 2a6f984

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/factory.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,6 @@ const defaults = {
2121
type: 'go',
2222
env: {},
2323
args: [],
24-
ipfsHttpModule: {
25-
path: require.resolve('ipfs-http-client'),
26-
ref: require('ipfs-http-client')
27-
},
2824
ipfsOptions: {},
2925
forceKill: true,
3026
forceKillTimeout: 5000
@@ -109,6 +105,15 @@ class Factory {
109105
options
110106
)
111107

108+
// only include the http api client if it has not been specified as an option
109+
// for example if we are testing the http api client itself
110+
if (!opts.ipfsHttpModule) {
111+
opts.ipfsHttpModule = {
112+
path: require.resolve('ipfs-http-client'),
113+
ref: require('ipfs-http-client')
114+
}
115+
}
116+
112117
// conditionally include ipfs based on which type of daemon we will spawn when none has been specifed
113118
if ((opts.type === 'js' || opts.type === 'proc') && !opts.ipfsModule) {
114119
opts.ipfsModule = {

0 commit comments

Comments
 (0)