mirror of https://gitlab.com/ecentrics/concordia
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
963 B
35 lines
963 B
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) => {
|
|
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,
|
|
},
|
|
});
|
|
});
|
|
|
|
export default getIpfsOptions;
|
|
|