This repository was archived by the owner on Feb 12, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 5 files changed +22
-24
lines changed Expand file tree Collapse file tree 5 files changed +22
-24
lines changed Original file line number Diff line number Diff line change 11'use strict'
22
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
48
59module . exports = function bootstrap ( self ) {
610 return {
Original file line number Diff line number Diff line change 33const peerId = require ( 'peer-id' )
44const waterfall = require ( 'async/waterfall' )
55const parallel = require ( 'async/parallel' )
6+ const isNode = require ( 'detect-node' )
67
78const addDefaultAssets = require ( './init-assets' )
89
@@ -20,13 +21,9 @@ module.exports = function init (self) {
2021 opts . bits = Number ( opts . bits ) || 2048
2122 opts . log = opts . log || function ( ) { }
2223
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' )
3027
3128 waterfall ( [
3229 // Verify repo does not yet exist.
@@ -62,9 +59,7 @@ module.exports = function init (self) {
6259 ]
6360
6461 if ( typeof addDefaultAssets === 'function' ) {
65- tasks . push (
66- ( cb ) => addDefaultAssets ( self , opts . log , cb )
67- )
62+ tasks . push ( ( cb ) => addDefaultAssets ( self , opts . log , cb ) )
6863 }
6964
7065 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 11{
22 "Addresses" : {
33 "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"
56 ],
67 "API" : " /ip4/127.0.0.1/tcp/5002" ,
78 "Gateway" : " /ip4/127.0.0.1/tcp/9090"
1213 "Interval" : 10
1314 }
1415 },
15- "Mounts" : {
16- "IPFS" : " /ipfs" ,
17- "IPNS" : " /ipns"
18- },
19- "Ipns" : {
20- "ResolveCacheSize" : 128
21- },
22- "Gateway" : {
23- "RootRedirect" : " " ,
24- "Writable" : false
25- },
2616 "Bootstrap" : [
2717 " /ip4/104.131.131.82/tcp/4001/ipfs/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ" ,
2818 " /ip4/104.236.176.52/tcp/4001/ipfs/QmSoLnSGccFuZQJzRadHn95W2CrSFmZuTdDWP8HXaHca9z" ,
Original file line number Diff line number Diff line change 33
44const expect = require ( 'chai' ) . expect
55const 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
77
88module . exports = ( http ) => {
99 describe ( '/bootstrap' , ( ) => {
You can’t perform that action at this time.
0 commit comments