diff --git a/packages/concordia-pinner/src/constants.js b/packages/concordia-pinner/src/constants.js index 7bfe01f..6e18d38 100644 --- a/packages/concordia-pinner/src/constants.js +++ b/packages/concordia-pinner/src/constants.js @@ -1,4 +1,5 @@ import path from 'path'; export const ORBIT_DIRECTORY_DEFAULT = path.join(__dirname, '..', 'orbitdb'); +export const IPFS_DIRECTORY_DEFAULT = path.join(__dirname, '..', 'ipfs'); export const LOGS_PATH = path.join(__dirname, '..', 'logs'); diff --git a/packages/concordia-pinner/src/options/ipfsOptions.js b/packages/concordia-pinner/src/options/ipfsOptions.js index 191fffc..56e1fbb 100644 --- a/packages/concordia-pinner/src/options/ipfsOptions.js +++ b/packages/concordia-pinner/src/options/ipfsOptions.js @@ -1,30 +1,36 @@ import getLibp2pBundle from './libp2pBundle'; import { getSwarmAddresses } from '../utils/ipfsUtils'; import { logger } from '../utils/logger'; +import { IPFS_DIRECTORY_DEFAULT } from '../constants'; const getIpfsOptions = async () => getSwarmAddresses() .then((swarmAddresses) => { logger.info(`Swarm addresses used: ${swarmAddresses.join(', ')}`); return swarmAddresses; }) - .then((swarmAddresses) => ({ - repo: 'ipfs', - config: { - Profile: 'server', - Addresses: { - Swarm: swarmAddresses, + .then((swarmAddresses) => { + const IPFS_DIRECTORY = process.env.IPFS_DIRECTORY || IPFS_DIRECTORY_DEFAULT; + logger.info(`Setting up IPFS in repo: ${IPFS_DIRECTORY}`); + + return ({ + repo: IPFS_DIRECTORY, + config: { + Profile: 'server', + Addresses: { + Swarm: swarmAddresses, + }, + }, + libp2p: getLibp2pBundle(swarmAddresses), + EXPERIMENTAL: { + pubsub: true, + }, + preload: { + enabled: false, + }, + init: { + emptyRepo: true, }, - }, - libp2p: getLibp2pBundle(swarmAddresses), - EXPERIMENTAL: { - pubsub: true, - }, - preload: { - enabled: false, - }, - init: { - emptyRepo: true, - }, - })); + }); + }); export default getIpfsOptions; diff --git a/packages/concordia-pinner/src/utils/orbitUtils.js b/packages/concordia-pinner/src/utils/orbitUtils.js index e13877a..d1c3326 100644 --- a/packages/concordia-pinner/src/utils/orbitUtils.js +++ b/packages/concordia-pinner/src/utils/orbitUtils.js @@ -25,6 +25,7 @@ export const createOrbitInstance = async (ipfs, contractAddress) => { EthereumContractIdentityProvider.setContractAddress(contractAddress); const ORBIT_DIRECTORY = process.env.ORBIT_DIRECTORY || ORBIT_DIRECTORY_DEFAULT; + logger.info(`Setting up OrbitDB in directory: ${ORBIT_DIRECTORY}`); return OrbitDB.createInstance(ipfs, { directory: ORBIT_DIRECTORY }); };