fix(ipfs): Adding gateway setting to config

This commit is contained in:
Chris Troutner
2022-10-01 14:20:37 -07:00
parent 85d6aa7d46
commit 7cefbd71ef
2 changed files with 6 additions and 3 deletions
+4 -1
View File
@@ -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/'
}
+2 -2
View File
@@ -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)}`)