File tree Expand file tree Collapse file tree 1 file changed +12
-8
lines changed Expand file tree Collapse file tree 1 file changed +12
-8
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ class InProc {
22
22
/** @type ControllerOptions */
23
23
this . opts = opts
24
24
this . path = this . opts . ipfsOptions . repo || ( opts . disposable ? tmpDir ( opts . type ) : defaultRepo ( opts . type ) )
25
+ this . initOptions = toInitOptions ( opts . ipfsOptions . init )
25
26
this . disposable = opts . disposable
26
27
this . initialized = false
27
28
this . started = false
@@ -38,10 +39,12 @@ class InProc {
38
39
39
40
const IPFS = this . opts . ipfsModule
40
41
41
- this . api = await IPFS . create ( merge ( {
42
+ this . api = await IPFS . create ( {
43
+ ...this . opts . ipfsOptions ,
42
44
silent : true ,
43
- repo : this . path
44
- } , this . opts . ipfsOptions ) )
45
+ repo : this . path ,
46
+ init : this . initOptions
47
+ } )
45
48
}
46
49
47
50
/**
@@ -79,18 +82,16 @@ class InProc {
79
82
}
80
83
81
84
// Repo not initialized
82
- const opts = merge (
85
+ this . initOptions = merge (
83
86
{
84
87
emptyRepo : false ,
85
88
profiles : this . opts . test ? [ 'test' ] : [ ]
86
89
} ,
87
- typeof this . opts . ipfsOptions . init === 'boolean' ? { } : this . opts . ipfsOptions . init ,
88
- typeof initOptions === 'boolean' ? { } : initOptions
90
+ this . initOptions ,
91
+ toInitOptions ( initOptions )
89
92
)
90
93
91
94
await this . setExec ( )
92
- await this . api . init ( opts )
93
-
94
95
this . clean = false
95
96
this . initialized = true
96
97
return this
@@ -173,4 +174,7 @@ class InProc {
173
174
}
174
175
}
175
176
177
+ const toInitOptions = ( init ) =>
178
+ typeof init === 'boolean' ? { } : init
179
+
176
180
module . exports = InProc
You can’t perform that action at this time.
0 commit comments