|
| 1 | + |
| 2 | +# config |
| 3 | + |
| 4 | +All ssb options here: <https://github.com/ssbc/ssb-config#configuration> |
| 5 | + |
| 6 | +## default config |
| 7 | + |
| 8 | +Agregore has this default configuration: |
| 9 | + |
| 10 | +```js |
| 11 | + ssbOptions: { |
| 12 | + appname: 'agregore-ssb', |
| 13 | + ssbd: { |
| 14 | + runServer: true, |
| 15 | + plugins: require('@metacentre/shipyard-ssb') |
| 16 | + } |
| 17 | + }, |
| 18 | +``` |
| 19 | + |
| 20 | +The ssb data directory resides at `~/.agregore-ssb` |
| 21 | + |
| 22 | +## custom config |
| 23 | + |
| 24 | +Custom configuration can be set in `~/.agregorerc` |
| 25 | + |
| 26 | +The ssb data directory can be changed by altering `appname`. |
| 27 | + |
| 28 | +To connnect to a different ssb-server, set `runServer` to false. For example: |
| 29 | + |
| 30 | +```json |
| 31 | +{ |
| 32 | + "ssbOptions": { |
| 33 | + "ssbd": { |
| 34 | + "appname": "ssb", |
| 35 | + "runServer": false |
| 36 | + } |
| 37 | + } |
| 38 | +} |
| 39 | +``` |
| 40 | + |
| 41 | +In this case `ssb-fetch` will connect to the server configured at `~/.ssb` |
| 42 | + |
| 43 | +## ssb_appname env var |
| 44 | + |
| 45 | +If agregore is run in an environment with `ssb_appname` set, `ssb-fetch` will use config in that directory. |
| 46 | + |
| 47 | +For example, from the root directory of agregore: |
| 48 | + |
| 49 | +```sh |
| 50 | +ssb_appname=ssb-test yarn start |
| 51 | +``` |
| 52 | + |
| 53 | +will use config at `~/.ssb-test/config` |
| 54 | + |
| 55 | +# plugins |
| 56 | + |
| 57 | +## default plugins list |
| 58 | + |
| 59 | +ssb functionality is provided by [Secret-Stack muxrpc plugins](https://github.com/ssbc/secret-stack/blob/main/PLUGINS.md). Agregore bundles [`ssbd` an ssb daemon](https://github.com/av8ta/ssbd) with a default selection of plugins preinstalled. |
| 60 | + |
| 61 | +## custom plugins list |
| 62 | + |
| 63 | +Custom plugins can optionally be specified in `~/.agregorerc` instead. An absolute path is necessary. |
| 64 | + |
| 65 | +```json |
| 66 | +{ |
| 67 | + "ssbOptions": { |
| 68 | + "ssbd": { |
| 69 | + "plugins": ["/absolute/path/to/list/of/plugins/to/require"] |
| 70 | + } |
| 71 | + }, |
| 72 | +} |
| 73 | +``` |
| 74 | + |
| 75 | +The list of plugins is a module exporting an array of require'd ssb plugins. Below is an example from [shipyard-ssb](https://github.com/metacentre/shipyard-ssb): |
| 76 | + |
| 77 | +```js |
| 78 | +module.exports = [ |
| 79 | + require('ssb-db'), |
| 80 | + require('ssb-master'), |
| 81 | + require('ssb-private1'), |
| 82 | + require('ssb-onion'), |
| 83 | + require('ssb-unix-socket'), |
| 84 | + require('ssb-no-auth'), |
| 85 | + require('ssb-gossip'), |
| 86 | + require('ssb-replicate'), |
| 87 | + require('ssb-friends'), |
| 88 | + require('ssb-blobs'), |
| 89 | + require('ssb-invite'), |
| 90 | + require('ssb-local'), |
| 91 | + require('ssb-logging'), |
| 92 | + require('ssb-query'), |
| 93 | + require('ssb-links'), |
| 94 | + require('ssb-ws'), |
| 95 | + require('ssb-ebt'), |
| 96 | + require('ssb-ooo'), |
| 97 | +] |
| 98 | +``` |
| 99 | + |
| 100 | +## user supplied override plugins |
| 101 | + |
| 102 | +`ssbd` uses `ssb-plugins` under the hood as another way to specify plugins. These plugins will override the plugins above. They are [installed manually](https://github.com/ssbc/ssb-plugins#installing-a-user-configured-ssb-plugin-manually) to the node_modules directory in the ssb data directory. Historically in `~/.ssb/node_modules/`. In the case of agregore, in `~/.agregore-ssb/node_modules/`. |
| 103 | + |
| 104 | +# config scenarios in ~/.agregorerc |
| 105 | + |
| 106 | +Run bundled `ssbd` with *bundled* plugins. Data dir `~/.agregore-ssb` |
| 107 | + |
| 108 | +```json |
| 109 | +{ |
| 110 | + "ssbOptions": { |
| 111 | + "ssbd": { |
| 112 | + "runServer": true |
| 113 | + } |
| 114 | + } |
| 115 | +} |
| 116 | +``` |
| 117 | + |
| 118 | +Run bundled `ssbd` with *custom* plugins. Data dir `~/.agregore-ssb` |
| 119 | + |
| 120 | +Note the absolute path to plugins |
| 121 | + |
| 122 | +```json |
| 123 | +{ |
| 124 | + "ssbOptions": { |
| 125 | + "ssbd": { |
| 126 | + "runServer": true, |
| 127 | + "plugins": ["/home/av8ta/.agregore-plugins/index.js"] |
| 128 | + } |
| 129 | + } |
| 130 | +} |
| 131 | +``` |
| 132 | + |
| 133 | +Run bundled `ssbd` with *bundled* plugins. With previously existing data dir `~/.ssb` |
| 134 | + |
| 135 | +```json |
| 136 | +{ |
| 137 | + "ssbOptions": { |
| 138 | + "appname": "ssb", |
| 139 | + "ssbd": { |
| 140 | + "runServer": true |
| 141 | + } |
| 142 | + } |
| 143 | +} |
| 144 | +``` |
| 145 | + |
| 146 | +Do *not bundle* `ssbd`. Connect to running ssb-server. Data dir `~/.ssb` |
| 147 | + |
| 148 | +```json |
| 149 | +{ |
| 150 | + "ssbOptions": { |
| 151 | + "appname": "ssb", |
| 152 | + "ssbd": { |
| 153 | + "runServer": false |
| 154 | + } |
| 155 | + } |
| 156 | +} |
| 157 | +``` |
| 158 | + |
| 159 | +Do *not bundle* `ssbd`. Attempt to pass through config & connect to running ssb-server. Data dir `~/.ssb` |
| 160 | + |
| 161 | +```json |
| 162 | +{ |
| 163 | + "ssbOptions": { |
| 164 | + "appname": "ssb", |
| 165 | + "npm": { |
| 166 | + "port": 8043 |
| 167 | + }, |
| 168 | + "ssbd": { |
| 169 | + "runServer": false |
| 170 | + } |
| 171 | + } |
| 172 | +} |
| 173 | +``` |
| 174 | + |
| 175 | +The npm port config here has no effect because agregore is unable to configure an already running ssb server. In cases like this, place your ssb config in the appropriate file. |
| 176 | + |
| 177 | +In `~/.agregorerc` |
| 178 | + |
| 179 | +```json |
| 180 | +{ |
| 181 | + "ssbOptions": { |
| 182 | + "appname": "ssb", |
| 183 | + "ssbd": { |
| 184 | + "runServer": false |
| 185 | + } |
| 186 | + } |
| 187 | +} |
| 188 | +``` |
| 189 | + |
| 190 | +In `~/.ssb/config` |
| 191 | + |
| 192 | +```json |
| 193 | +{ |
| 194 | + "npm": { |
| 195 | + "port": 8043 |
| 196 | + } |
| 197 | +} |
| 198 | +``` |
0 commit comments