Keep listening to updates from any given orbit-db store
Installation
To install pinion, run:
yarn add global @colony/pinion
or
npm i -g @colony/pinion
Usage (for the impatient)
And then run pinion passing an IPFS node endpoint and a pinning room:
PINION_ROOM=YOUR_PINNING_ROOM pinion
In this configuration we're assuming some sensible defaults. See below.
Custom configuration
Pinion can be configured by either passing in the configuration programatically to its constructor (with the only required value being the room, see defaults in the example):
The IPFS pubsub room pinion is going to join and listen to new messages to.
PINION_MAX_OPEN_STORES
(optional)
You can also specify the limit of how many stores you wanna keep open simultaneously by passing in an environment variable MAX_OPEN_STORES. The stores will be automatically allocated using a LRU algorithm. The limit is by default set to 100 stores.
PINION_IPFS_CONFIG_FILE
(optional)
Define a config file to use (see ipfsConfig.production.example.json for an example).
PINION_IPFS_PRIVATE_KEY
(optional)
The private key that is used to initialize the IPFS repo. Will generate a random key when omitted.
PINION_IPFS_REPO
(optional)
You can specify the an IPFS repo path of your preference. The default is ./ipfs.
PINION_ORBIT_DB_DIR
(optional)
You can specify the orbit-db path option so stores data are kept in the place of your preference. The default is ./orbitdb
Debug
Pinion is still on its infancy and you might need debug info or a more detailed output to figure out if it misbehaves. To run it on verbose/debug mode, please also set an environment var like so DEBUG='pinner:*'.
API
Requests
REPLICATE
Opens a store, loads it and keep listening to it until it's being cleaned up by the LRU cache.
Start an ipfs node on localhost on port 4001. You can use the commands provided in the package.json using either yarn ipfsd-go or yarn ipfsd-js (Docker has to be running on your system).
请发表评论