diff --git a/packages/concordia-pinner/src/options/ipfsOptions.js b/packages/concordia-pinner/src/options/ipfsOptions.js index 56e1fbb..e32f5f8 100644 --- a/packages/concordia-pinner/src/options/ipfsOptions.js +++ b/packages/concordia-pinner/src/options/ipfsOptions.js @@ -7,8 +7,7 @@ const getIpfsOptions = async () => getSwarmAddresses() .then((swarmAddresses) => { logger.info(`Swarm addresses used: ${swarmAddresses.join(', ')}`); return swarmAddresses; - }) - .then((swarmAddresses) => { + }).then((swarmAddresses) => { const IPFS_DIRECTORY = process.env.IPFS_DIRECTORY || IPFS_DIRECTORY_DEFAULT; logger.info(`Setting up IPFS in repo: ${IPFS_DIRECTORY}`); diff --git a/packages/concordia-pinner/src/utils/ipfsUtils.js b/packages/concordia-pinner/src/utils/ipfsUtils.js index 4a8ffe3..3491c5f 100644 --- a/packages/concordia-pinner/src/utils/ipfsUtils.js +++ b/packages/concordia-pinner/src/utils/ipfsUtils.js @@ -5,10 +5,17 @@ import { logger } from './logger'; const dnsLookup = util.promisify(dns.lookup); -export const getResolvedRendezvousUrl = async () => dnsLookup(rendezvousHost, { family: 4 }) - .catch((error) => logger.error(new Error(`DNS lookup of ${rendezvousHost} failed.\n${error}`))); +export const getResolvedRendezvousUrl = async () => { + if (rendezvousHost.startsWith('/docker/')) { + return dnsLookup(rendezvousHost.substring('/docker/'.length), { family: 4 }) + .then((resolvedDomain) => `/ip4/${resolvedDomain.address}`) + .catch((error) => logger.error(new Error(`DNS lookup of ${rendezvousHost} failed.\n${error}`))); + } + + return Promise.resolve(rendezvousHost); +}; export const getSwarmAddresses = async () => getResolvedRendezvousUrl() - .then((resolvedRendezvousUrl) => [ - `${resolvedRendezvousUrl.address}/tcp/${rendezvousPort}/wss/p2p-webrtc-star`, + .then((resolvedRendezvousHost) => [ + `${resolvedRendezvousHost}/tcp/${rendezvousPort}/wss/p2p-webrtc-star`, ]);