This repository was archived by the owner on Feb 12, 2024. It is now read-only.
File tree 5 files changed +22
-24
lines changed
5 files changed +22
-24
lines changed Original file line number Diff line number Diff line change 1
1
'use strict'
2
2
3
- const defaultNodes = require ( '../../init-files/default-config.json' ) . Bootstrap
3
+ const isNode = require ( 'detect-node' )
4
+
5
+ const defaultNodes = isNode
6
+ ? require ( '../../init-files/default-config-node.json' ) . Bootstrap
7
+ : require ( '../../init-files/default-config-browser.json' ) . Bootstrap
4
8
5
9
module . exports = function bootstrap ( self ) {
6
10
return {
Original file line number Diff line number Diff line change 3
3
const peerId = require ( 'peer-id' )
4
4
const waterfall = require ( 'async/waterfall' )
5
5
const parallel = require ( 'async/parallel' )
6
+ const isNode = require ( 'detect-node' )
6
7
7
8
const addDefaultAssets = require ( './init-assets' )
8
9
@@ -20,13 +21,9 @@ module.exports = function init (self) {
20
21
opts . bits = Number ( opts . bits ) || 2048
21
22
opts . log = opts . log || function ( ) { }
22
23
23
- let config
24
- // Pre-set config values.
25
- try {
26
- config = require ( '../../init-files/default-config.json' )
27
- } catch ( err ) {
28
- return callback ( err )
29
- }
24
+ const config = isNode
25
+ ? require ( '../../init-files/default-config-node.json' )
26
+ : require ( '../../init-files/default-config-browser.json' )
30
27
31
28
waterfall ( [
32
29
// Verify repo does not yet exist.
@@ -62,9 +59,7 @@ module.exports = function init (self) {
62
59
]
63
60
64
61
if ( typeof addDefaultAssets === 'function' ) {
65
- tasks . push (
66
- ( cb ) => addDefaultAssets ( self , opts . log , cb )
67
- )
62
+ tasks . push ( ( cb ) => addDefaultAssets ( self , opts . log , cb ) )
68
63
}
69
64
70
65
parallel ( tasks , ( err ) => {
Original file line number Diff line number Diff line change
1
+ {
2
+ "Addresses" : {
3
+ "Swarm" : [],
4
+ "API" : " /ip4/127.0.0.1/tcp/5002" ,
5
+ "Gateway" : " /ip4/127.0.0.1/tcp/9090"
6
+ },
7
+ "Discovery" : {},
8
+ "Bootstrap" : []
9
+ }
Original file line number Diff line number Diff line change 1
1
{
2
2
"Addresses" : {
3
3
"Swarm" : [
4
- " /ip4/0.0.0.0/tcp/4002"
4
+ " /ip4/0.0.0.0/tcp/4002" ,
5
+ " /ip4/127.0.0.1/tcp/4003/ws"
5
6
],
6
7
"API" : " /ip4/127.0.0.1/tcp/5002" ,
7
8
"Gateway" : " /ip4/127.0.0.1/tcp/9090"
12
13
"Interval" : 10
13
14
}
14
15
},
15
- "Mounts" : {
16
- "IPFS" : " /ipfs" ,
17
- "IPNS" : " /ipns"
18
- },
19
- "Ipns" : {
20
- "ResolveCacheSize" : 128
21
- },
22
- "Gateway" : {
23
- "RootRedirect" : " " ,
24
- "Writable" : false
25
- },
26
16
"Bootstrap" : [
27
17
" /ip4/104.131.131.82/tcp/4001/ipfs/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ" ,
28
18
" /ip4/104.236.176.52/tcp/4001/ipfs/QmSoLnSGccFuZQJzRadHn95W2CrSFmZuTdDWP8HXaHca9z" ,
Original file line number Diff line number Diff line change 3
3
4
4
const expect = require ( 'chai' ) . expect
5
5
const qs = require ( 'qs' )
6
- const defaultList = require ( '../../../src/init-files/default-config.json' ) . Bootstrap
6
+ const defaultList = require ( '../../../src/init-files/default-config-node .json' ) . Bootstrap
7
7
8
8
module . exports = ( http ) => {
9
9
describe ( '/bootstrap' , ( ) => {
You can’t perform that action at this time.
0 commit comments