|
| 1 | +# The js-ipfs config file |
| 2 | + |
| 3 | +The js-ipfs config file is a JSON document located in the root directory of the js-ipfs repository. |
| 4 | + |
| 5 | +## Table of Contents |
| 6 | + |
| 7 | +- [`Addresses`](#addresses) |
| 8 | +- [`Bootstrap`](#bootstrap) |
| 9 | +- [`Datastore`](#datastore) |
| 10 | +- [`Discovery`](#discovery) |
| 11 | +- [`Identity`](#identity) |
| 12 | +- [`Keychain`](#keychain) |
| 13 | +- [`Swarm`](#swarm) |
| 14 | + |
| 15 | + |
| 16 | +## `Addresses` |
| 17 | +Contains information about various listener addresses to be used by this node. |
| 18 | + |
| 19 | +- `API` |
| 20 | + The IPFS daemon exposes an HTTP API that allows to control the node and run the same commands as you can do from the command line. It is defined on the [HTTP API Spec](https://docs.ipfs.io/reference/api/http). |
| 21 | + |
| 22 | + [Multiaddr](https://github.com/multiformats/multiaddr/) or array of [Multiaddr](https://github.com/multiformats/multiaddr/) describing the address(es) to serve the HTTP API on. |
| 23 | + |
| 24 | + Default: `/ip4/127.0.0.1/tcp/5002` |
| 25 | + |
| 26 | +- `Gateway` |
| 27 | + A gateway is exposed by the IPFS daemon, which allows an easy way to access content from IPFS, using an IPFS path. |
| 28 | + |
| 29 | + [Multiaddr](https://github.com/multiformats/multiaddr/) or array of [Multiaddr](https://github.com/multiformats/multiaddr/) describing the address(es) to serve the gateway on. |
| 30 | + |
| 31 | + Default: `/ip4/127.0.0.1/tcp/9090` |
| 32 | + |
| 33 | +- `Swarm` |
| 34 | + Array of [Multiaddr](https://github.com/multiformats/multiaddr/) describing which addresses to listen on for p2p swarm connections. |
| 35 | + |
| 36 | + Default: |
| 37 | + ```json |
| 38 | + [ |
| 39 | + "/ip4/0.0.0.0/tcp/4002", |
| 40 | + "/ip4/127.0.0.1/tcp/4003/ws" |
| 41 | + ] |
| 42 | + ``` |
| 43 | + |
| 44 | +## `Bootstrap` |
| 45 | +Bootstrap is an array of [Multiaddr](https://github.com/multiformats/multiaddr/) of trusted nodes to connect to in order to |
| 46 | +initiate a connection to the network. |
| 47 | + |
| 48 | +## `Datastore` |
| 49 | +Contains information related to the construction and operation of the on-disk |
| 50 | +storage system. |
| 51 | + |
| 52 | +- `Spec` |
| 53 | + Spec defines the structure of the IPFS datastore. It is a composable structure, where each datastore is represented by a JSON object. Datastores can wrap other datastores to provide extra functionality (e.g. metrics, logging, or caching). |
| 54 | + |
| 55 | + This can be changed manually, however, if you make any changes that require a different on-disk structure, you will need to run the [ipfs-ds-convert tool](https://github.com/ipfs/ipfs-ds-convert) to migrate data into the new structures. |
| 56 | + |
| 57 | + Default: |
| 58 | + ``` |
| 59 | + { |
| 60 | + "mounts": [ |
| 61 | + { |
| 62 | + "child": { |
| 63 | + "path": "blocks", |
| 64 | + "shardFunc": "/repo/flatfs/shard/v1/next-to-last/2", |
| 65 | + "sync": true, |
| 66 | + "type": "flatfs" |
| 67 | + }, |
| 68 | + "mountpoint": "/blocks", |
| 69 | + "prefix": "flatfs.datastore", |
| 70 | + "type": "measure" |
| 71 | + }, |
| 72 | + { |
| 73 | + "child": { |
| 74 | + "compression": "none", |
| 75 | + "path": "datastore", |
| 76 | + "type": "levelds" |
| 77 | + }, |
| 78 | + "mountpoint": "/", |
| 79 | + "prefix": "leveldb.datastore", |
| 80 | + "type": "measure" |
| 81 | + } |
| 82 | + ], |
| 83 | + "type": "mount" |
| 84 | + } |
| 85 | + ``` |
| 86 | + |
| 87 | +## `Discovery` |
| 88 | +Contains options for configuring IPFS node discovery mechanisms. |
| 89 | + |
| 90 | +- `MDNS` |
| 91 | + Multicast DNS is a discovery protocol that is able to find other peers on the local network. |
| 92 | + |
| 93 | + Options for Multicast DNS peer discovery. |
| 94 | + |
| 95 | + - `Enabled` |
| 96 | + A boolean value for whether or not MDNS should be active. |
| 97 | + |
| 98 | + Default: `true` |
| 99 | + |
| 100 | + - `Interval` |
| 101 | + A number of seconds to wait between discovery checks. |
| 102 | + |
| 103 | + Default: `10` |
| 104 | + |
| 105 | +- `webRTCStar` |
| 106 | + WebRTCStar is a discovery mechanism prvided by a signalling-star that allows peer-to-peer communications in the browser. |
| 107 | + |
| 108 | + Options for webRTCstar peer discovery. |
| 109 | + |
| 110 | + - `Enabled` |
| 111 | + A boolean value for whether or not webRTCStar should be active. |
| 112 | + |
| 113 | + Default: `true` |
| 114 | + |
| 115 | +## `Identity` |
| 116 | + |
| 117 | +- `PeerID` |
| 118 | + The unique PKI identity label for this configs peer. Set on init and never read, its merely here for convenience. IPFS will always generate the peerID from its keypair at runtime. |
| 119 | + |
| 120 | +- `PrivKey` |
| 121 | + The base64 encoded protobuf describing (and containing) the nodes private key. |
| 122 | + |
| 123 | +## `Keychain` |
| 124 | + |
| 125 | + |
| 126 | + |
| 127 | +## `Swarm` |
| 128 | + |
| 129 | +Options for configuring the swarm. |
| 130 | + |
| 131 | +### `ConnMgr` |
| 132 | + |
| 133 | +The connection manager determines which and how many connections to keep and can be configured to keep. |
| 134 | + |
| 135 | +- `LowWater` |
| 136 | + LowWater is the minimum number of connections to maintain. |
| 137 | + |
| 138 | + Default: 200 (both browser and node.js) |
| 139 | + |
| 140 | +- `HighWater` |
| 141 | + HighWater is the number of connections that, when exceeded, will trigger a connection GC operation. |
| 142 | + |
| 143 | + Default: 500 (both browser and node.js) |
| 144 | + |
| 145 | + |
| 146 | +The "basic" connection manager tries to keep between `LowWater` and `HighWater` connections. It works by: |
| 147 | + |
| 148 | +1. Keeping all connections until `HighWater` connections is reached. |
| 149 | +2. Once `HighWater` is reached, it closes connections until `LowWater` is reached. |
| 150 | + |
| 151 | +**Example:** |
| 152 | + |
| 153 | + |
| 154 | +```json |
| 155 | +{ |
| 156 | + "Swarm": { |
| 157 | + "ConnMgr": { |
| 158 | + "LowWater": 100, |
| 159 | + "HighWater": 200, |
| 160 | + } |
| 161 | + } |
| 162 | +} |
| 163 | +``` |
0 commit comments