This repository was archived by the owner on Feb 12, 2024. It is now read-only.
File tree 2 files changed +10
-5
lines changed
2 files changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -4,13 +4,15 @@ const utils = require('../utils')
4
4
const print = utils . print
5
5
6
6
module . exports = {
7
- command : 'init' ,
8
-
7
+ command : 'init [config] [options]' ,
9
8
describe : 'Initialize a local IPFS node' ,
10
-
11
9
builder ( yargs ) {
12
10
return yargs
13
11
. epilog ( utils . ipfsPathHelp )
12
+ . positional ( 'config' , {
13
+ describe : 'Node config, this should JSON and will be merged with the default config. Check https://github.com/ipfs/js-ipfs#optionsconfig' ,
14
+ type : 'string'
15
+ } )
14
16
. option ( 'bits' , {
15
17
type : 'number' ,
16
18
alias : 'b' ,
@@ -41,7 +43,8 @@ module.exports = {
41
43
const node = new IPFS ( {
42
44
repo : new Repo ( path ) ,
43
45
init : false ,
44
- start : false
46
+ start : false ,
47
+ config : argv . config
45
48
} )
46
49
47
50
node . init ( {
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ const peerId = require('peer-id')
4
4
const waterfall = require ( 'async/waterfall' )
5
5
const parallel = require ( 'async/parallel' )
6
6
const promisify = require ( 'promisify-es6' )
7
+ const extend = require ( 'deep-extend' )
7
8
const defaultConfig = require ( '../runtime/config-nodejs.js' )
8
9
const Keychain = require ( 'libp2p-keychain' )
9
10
@@ -50,7 +51,8 @@ module.exports = function init (self) {
50
51
opts . emptyRepo = opts . emptyRepo || false
51
52
opts . bits = Number ( opts . bits ) || 2048
52
53
opts . log = opts . log || function ( ) { }
53
- const config = defaultConfig ( )
54
+
55
+ const config = extend ( defaultConfig ( ) , self . _options . config )
54
56
let privateKey
55
57
56
58
waterfall ( [
You can’t perform that action at this time.
0 commit comments