From 7cefbd71ef980e4829fa7fe49e0ff64c18b94a27 Mon Sep 17 00:00:00 2001 From: Chris Troutner Date: Sat, 1 Oct 2022 14:20:37 -0700 Subject: [PATCH] fix(ipfs): Adding gateway setting to config --- config/env/common.js | 5 ++++- src/use-cases/offer/index.js | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/config/env/common.js b/config/env/common.js index 342f46f..50df7cf 100644 --- a/config/env/common.js +++ b/config/env/common.js @@ -113,5 +113,8 @@ export default { ? parseInt(process.env.IPFS_API_PORT) : 5001, - chatPubSubChan: 'psf-ipfs-chat-001' + chatPubSubChan: 'psf-ipfs-chat-001', + + // IPFS gateway + ipfsGateway: process.env.IPFS_GATEWAY ? process.env.IPFS_GATEWAY : 'https://p2wdb-gateway.fullstack.cash/ipfs/' } diff --git a/src/use-cases/offer/index.js b/src/use-cases/offer/index.js index 9df3c2f..241b895 100644 --- a/src/use-cases/offer/index.js +++ b/src/use-cases/offer/index.js @@ -18,7 +18,6 @@ import axios from 'axios' // Local libraries import OfferEntity from '../../entities/offer.js' - import config from '../../../config/index.js' const DEFAULT_ENTRIES_PER_PAGE = 20 @@ -132,7 +131,8 @@ class OfferUseCases { const cid = mutableCid.substring(7) // Retrieve the mutable data from Filecoin/IPFS. - const url = `https://${cid}.ipfs.w3s.link/data.json` + // const url = `https://${cid}.ipfs.w3s.link/data.json` + const url = `${this.config.ipfsGateway}${cid}/data.json` const result = await axios.get(url) const mutableData = result.data console.log(`mutableData: ${JSON.stringify(mutableData, null, 2)}`)