mirror of https://gitlab.com/ecentrics/concordia
Apostolos Fanakis
4 years ago
7 changed files with 54 additions and 33 deletions
@ -1,6 +1,5 @@ |
|||||
import path from 'path'; |
import path from 'path'; |
||||
import getBreezeConfiguration from 'concordia-shared/src/configuration/breezeConfiguration'; |
|
||||
|
|
||||
export const swarmAddresses = getBreezeConfiguration().ipfs.config.Addresses.Swarm; |
const ORBIT_DIRECTORY_DEFAULT = path.join(__dirname, '..', 'orbitdb'); |
||||
|
|
||||
export const ORBIT_DIRECTORY_DEFAULT = path.join(__dirname, '..', 'orbitdb'); |
export default ORBIT_DIRECTORY_DEFAULT; |
||||
|
@ -1,22 +1,25 @@ |
|||||
import libp2pBundle from './libp2pBundle'; |
import getLibp2pBundle from './libp2pBundle'; |
||||
import { swarmAddresses } from '../constants'; |
import { getSwarmAddresses } from '../utils/ipfsUtils'; |
||||
|
|
||||
export default { |
const getIpfsOptions = async () => getSwarmAddresses() |
||||
repo: 'ipfs', |
.then((swarmAddresses) => ({ |
||||
config: { |
repo: 'ipfs', |
||||
Profile: 'server', |
config: { |
||||
Addresses: { |
Profile: 'server', |
||||
Swarm: swarmAddresses, |
Addresses: { |
||||
|
Swarm: swarmAddresses, |
||||
|
}, |
||||
}, |
}, |
||||
}, |
libp2p: getLibp2pBundle(swarmAddresses), |
||||
libp2p: libp2pBundle, |
EXPERIMENTAL: { |
||||
EXPERIMENTAL: { |
pubsub: true, |
||||
pubsub: true, |
}, |
||||
}, |
preload: { |
||||
preload: { |
enabled: false, |
||||
enabled: false, |
}, |
||||
}, |
init: { |
||||
init: { |
emptyRepo: true, |
||||
emptyRepo: true, |
}, |
||||
}, |
})); |
||||
}; |
|
||||
|
export default getIpfsOptions; |
||||
|
@ -0,0 +1,11 @@ |
|||||
|
import dns from 'dns'; |
||||
|
import util from 'util'; |
||||
|
import { rendezvousHost, rendezvousPort } from 'concordia-shared/src/environment/interpolated/rendezvous'; |
||||
|
|
||||
|
const dnsLookup = util.promisify(dns.lookup); |
||||
|
|
||||
|
export const getResolvedRendezvousUrl = async () => dnsLookup(rendezvousHost, { family: 4 }) |
||||
|
.catch((error) => console.error(new Error(`DNS lookup of ${rendezvousHost} failed.\n${error}`))); |
||||
|
|
||||
|
export const getSwarmAddresses = async () => getResolvedRendezvousUrl() |
||||
|
.then((resolvedRendezvousUrl) => [`/ip4/${resolvedRendezvousUrl.address}/tcp/${rendezvousPort}/wss/p2p-webrtc-star`]); |
Loading…
Reference in new issue