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 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 { swarmAddresses } from '../constants'; |
|||
import getLibp2pBundle from './libp2pBundle'; |
|||
import { getSwarmAddresses } from '../utils/ipfsUtils'; |
|||
|
|||
export default { |
|||
repo: 'ipfs', |
|||
config: { |
|||
Profile: 'server', |
|||
Addresses: { |
|||
Swarm: swarmAddresses, |
|||
const getIpfsOptions = async () => getSwarmAddresses() |
|||
.then((swarmAddresses) => ({ |
|||
repo: 'ipfs', |
|||
config: { |
|||
Profile: 'server', |
|||
Addresses: { |
|||
Swarm: swarmAddresses, |
|||
}, |
|||
}, |
|||
}, |
|||
libp2p: libp2pBundle, |
|||
EXPERIMENTAL: { |
|||
pubsub: true, |
|||
}, |
|||
preload: { |
|||
enabled: false, |
|||
}, |
|||
init: { |
|||
emptyRepo: true, |
|||
}, |
|||
}; |
|||
libp2p: getLibp2pBundle(swarmAddresses), |
|||
EXPERIMENTAL: { |
|||
pubsub: true, |
|||
}, |
|||
preload: { |
|||
enabled: false, |
|||
}, |
|||
init: { |
|||
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