mirror of
https://github.com/oceanprotocol/commons.git
synced 2023-03-15 18:03:00 +01:00
allow multiple nodes running at same time
This commit is contained in:
parent
6db965b79a
commit
8127174fbd
@ -2,6 +2,8 @@
|
||||
|
||||
import Ipfs from 'ipfs'
|
||||
import { useEffect, useState } from 'react'
|
||||
import os from 'os'
|
||||
import shortid from 'shortid'
|
||||
|
||||
let ipfs: any = null
|
||||
let ipfsMessage = ''
|
||||
@ -24,7 +26,16 @@ export default function useIpfs() {
|
||||
const message = 'IPFS started'
|
||||
console.time(message)
|
||||
|
||||
ipfs = await Ipfs.create()
|
||||
ipfs = await Ipfs.create({
|
||||
repo: `${os.homedir()}/.jsipfs-${shortid.generate()}`,
|
||||
config: {
|
||||
Addresses: {
|
||||
// 0 for port so system just assigns a new free port
|
||||
// to allow multiple nodes running at same time
|
||||
Swarm: ['/ip4/0.0.0.0/tcp/0']
|
||||
}
|
||||
}
|
||||
})
|
||||
console.timeEnd(message)
|
||||
ipfsMessage = message
|
||||
|
||||
|
@ -5,22 +5,6 @@ import Files from '.'
|
||||
|
||||
const onChange = jest.fn()
|
||||
|
||||
// filter out IPFS node messages
|
||||
const originalLog = console.log
|
||||
|
||||
beforeAll(() => {
|
||||
console.log = (...args: any) => {
|
||||
if (/Swarm listening/.test(args[0])) {
|
||||
return
|
||||
}
|
||||
originalLog.call(console, ...args)
|
||||
}
|
||||
})
|
||||
|
||||
afterAll(() => {
|
||||
console.log = originalLog
|
||||
})
|
||||
|
||||
afterEach(() => {
|
||||
mockAxios.reset()
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user