UNPKG

15.8 kBJSONView Raw
1{
2 "$schema": "http://json-schema.org/draft-07/schema",
3 "$id": "Config.json",
4 "title": "Config",
5 "description": "Connector configuration schema.",
6 "type": "object",
7 "properties": {
8 "env": {
9 "description": "Determines what type of network the connector is a part of. Can be: 'production', 'test'. Default: 'test'",
10 "type": "string",
11 "enum": ["production", "test"],
12 "default": "test"
13 },
14 "ilpAddress": {
15 "description": "ILP address of the connector. This property can be omitted if an account with `relation=parent` is configured under `accounts`.",
16 "type": "string",
17 "pattern": "^[a-zA-Z0-9._~-]+$",
18 "default": "unknown"
19 },
20 "ilpAddressInheritFrom": {
21 "description": "If there are multiple parents, and `ilpAddress` is not set explicit, specify the account ID of the parent that we should load our address from. Defaults to the first parent in the `accounts` map.",
22 "type": "string",
23 "default": ""
24 },
25 "accounts": {
26 "description": "Description of connector account plugins.",
27 "type": "object",
28 "default": {},
29 "additionalProperties": {
30 "description": "Description of individual account.",
31 "type": "object",
32 "properties": {
33 "relation": {
34 "description": "Relationship between the connector and the counterparty that the account is with.",
35 "enum": ["parent", "peer", "child"]
36 },
37 "plugin": {
38 "description": "Name or instance of the ILP plugin that should be used for this account. A plugin instance can only be passed when instantiating the connector from JavaScript.",
39 "type": ["string", "object"]
40 },
41 "assetCode": {
42 "description": "Currency code or other asset identifier that will be passed to the backend to select the correct rate for this account.",
43 "type": "string"
44 },
45 "assetScale": {
46 "description": "Interledger amounts are integers, but most currencies are typically represented as fractional units, e.g. cents. This property defines how many Interledger units make up one regular units. For dollars, this would usually be set to 9, so that Interledger amounts are expressed in nanodollars.",
47 "type": "integer",
48 "minimum": 0,
49 "maximum": 255
50 },
51 "balance": {
52 "description": "Defines whether the connector should maintain and enforce a balance for this account. The balance is always from the connector's perspective. Therefore, a negative balance implies the connector owes money to the counterparty and a positive balance implies the counterparty owes money to the connector. This setting is enforced by the built-in `balance` middleware.",
53 "type": "object",
54 "properties": {
55 "minimum": {
56 "description": "Minimum balance (in this account's indivisible base units) the connector must maintain. The connector will reject outgoing packets if they would put it below this balance. The format is a string containing an integer (which may be prefixed with `-` to indicate a negative value), `\"-Infinity\"` or `\"Infinity\"`.",
57 "type": "string",
58 "pattern": "^(0|-?([1-9][0-9]*|Infinity))$"
59 },
60 "maximum": {
61 "description": "Maximum balance (in this account's indivisible base units) the connector will allow. The connector will reject incoming packets if they would put it above this balance. The format is a string containing an integer (which may be prefixed with `-` to indicate a negative value), `\"-Infinity\"` or `\"Infinity\"`.",
62 "type": "string",
63 "pattern": "^(0|-?([1-9][0-9]*|Infinity))$"
64 },
65 "settleThreshold": {
66 "description": "Balance (in this account's indivisible base units) numerically below which the connector will automatically initiate a settlement. The format is a string containing an integer (which may be prefixed with `-` to indicate a negative value) or `\"-Infinity\"`.",
67 "type": "string",
68 "pattern": "^(0|(-?[1-9][0-9]*|-Infinity))$"
69 },
70 "settleTo": {
71 "description": "Balance (in this account's indivisible base units) the connector will attempt to reach when settling. The format is an integer (which may be prefixed with `-` to indicate a negative value) as a string.",
72 "type": "string",
73 "pattern": "^(0|-?[1-9][0-9]*)$",
74 "default": "0"
75 }
76 },
77 "additionalProperties": false,
78 "required": ["maximum"]
79 },
80 "maxPacketAmount": {
81 "description": "Maximum amount per packet for incoming prepare packets. Connector will reject any incoming prepare packets from this account with a higher amount. Amount should be provided as an integer in a string (in atomic units). This setting is enforced by the built-in `maxPacketAmount` middleware.",
82 "type": "string",
83 "pattern": "^[1-9][0-9]*$"
84 },
85 "throughput": {
86 "description": "Configuration to limit the total amount sent via Interledger per unit of time. This setting is enforced by the built-in `throughput` middleware.",
87 "type": "object",
88 "properties": {
89 "refillPeriod": {
90 "description": "Length of time (in milliseconds) during which the token balance increases by `incomingAmount`/`outgoingAmount` tokens. Defaults to one second.",
91 "type": "integer",
92 "minimum": 100
93 },
94 "incomingAmount": {
95 "description": "Maximum incoming throughput amount (in atomic units; per second) for incoming packets. If this setting is not set, the incoming throughput limit is disabled.",
96 "type": "string",
97 "pattern": "^[1-9][0-9]*$"
98 },
99 "outgoingAmount": {
100 "description": "Maximum throughput amount (in atomic units; per second) for outgoing packets. If this setting is not set, the outgoing throughput limit is disabled.",
101 "type": "string",
102 "pattern": "^[1-9][0-9]*$"
103 }
104 },
105 "additionalProperties": false
106 },
107 "rateLimit": {
108 "description": "Maximum rate of incoming packets. Limit is implemented as a token bucket with a constant refill rate. When the token bucket is empty, all requests are immediately rejected. This setting is enforced by the built-in `rateLimit` middleware.",
109 "type": "object",
110 "properties": {
111 "refillPeriod": {
112 "description": "Length of time (in milliseconds) during which the token balance increases by `refillCount` tokens. Defaults to one second.",
113 "type": "integer",
114 "minimum": 100
115 },
116 "refillCount": {
117 "description": "How many tokens are refilled per period. The default refill period is one second, so this would be the average number of requests per second.",
118 "type": "integer",
119 "minimum": 1
120 },
121 "capacity": {
122 "description": "Maximum number of tokens in the bucket.",
123 "type": "integer",
124 "minimum": 0
125 }
126 },
127 "additionalProperties": false
128 },
129 "deduplicate": {
130 "description": "Prevents sending duplicate packets.",
131 "type": "object",
132 "properties": {
133 "cleanupInterval": {
134 "description": "Frequency at which the connector removes old deduplicate records. (in milliseconds, default: 30000)",
135 "type": "integer",
136 "minimum": 1
137 },
138 "packetLifetime": {
139 "description": "Lifetime of a cache record. (in milliseconds, default: 30000)",
140 "type": "integer",
141 "minimum": 1
142 }
143 },
144 "additionalProperties": false
145 },
146 "sendRoutes": {
147 "description": "Whether we should broadcast routes to this peer. Defaults to `false` for `relation=child` and `true` otherwise.",
148 "type": "boolean"
149 },
150 "receiveRoutes": {
151 "description": "Whether we should receive and process route broadcasts from this peer. Defaults to `false` for `relation=child` and `true` otherwise.",
152 "type": "boolean"
153 },
154 "options": {
155 "description": "Options that will be passed to the plugin constructor.",
156 "type": "object",
157 "additionalProperties": true
158 },
159 "ilpAddressSegment": {
160 "description": "What segment will be appended to the connector's ILP address to form this account's ILP address. Only applicable to accounts with `relation=child`. Defaults to the id of the account, i.e. the key used in the `accounts` config object.",
161 "type": "string",
162 "minLength": 1
163 }
164 },
165 "required": [
166 "relation",
167 "plugin",
168 "assetCode",
169 "assetScale"
170 ],
171 "additionalProperties": false
172 }
173 },
174 "defaultRoute": {
175 "description": "Which account should be used as the default route for all other traffic. Can be set to empty string to disable the default route or 'auto' to automatically use the first parent in the `accounts` map. Default: 'auto'",
176 "type": "string",
177 "default": "auto"
178 },
179 "routes": {
180 "description": "Additional routes to add to the connector's routing table.",
181 "type": "array",
182 "default": [],
183 "items": {
184 "description": "Description of a route entry.",
185 "type": "object",
186 "properties": {
187 "targetPrefix": {
188 "description": "ILP address prefix that this route applies to. Configured routes take precedence over the same or shorter prefixes that are local or published by peers. More specific prefixes will still take precedence. Prefixes should NOT include a trailing period.",
189 "type": "string",
190 "pattern": "^[a-zA-Z0-9._~-]+$"
191 },
192 "peerId": {
193 "description": "ID of the account that destinations matching `targetPrefix` should be forwarded to. Must be one of the accounts in `accounts`.",
194 "type": "string",
195 "pattern": "^[a-zA-Z0-9._~-]+$"
196 }
197 },
198 "required": ["targetPrefix", "peerId"],
199 "additionalProperties": false
200 }
201 },
202 "spread": {
203 "description": "How much of a spread to add on top of the reference exchange rate. Determines the connector's margin.",
204 "type": "number",
205 "default": 0.002
206 },
207 "minMessageWindow": {
208 "description": "Minimum time the connector wants to budget for getting a message to the accounts its trading on. In milliseconds.",
209 "type": "integer",
210 "default": 1000
211 },
212 "maxHoldTime": {
213 "description": "Maximum duration (in milliseconds) the connector is willing to place funds on hold while waiting for the outcome of a transaction.",
214 "type": "integer",
215 "default": 30000
216 },
217 "routeBroadcastEnabled": {
218 "description": "Whether to broadcast known routes.",
219 "type": "boolean",
220 "default": true
221 },
222 "routeBroadcastInterval": {
223 "description": "Frequency at which the connector broadcasts its routes to adjacent connectors. (in milliseconds)",
224 "type": "integer",
225 "default": 30000
226 },
227 "routeCleanupInterval": {
228 "description": "The frequency at which the connector checks for expired routes. (in milliseconds)",
229 "type": "integer",
230 "default": 1000
231 },
232 "routeExpiry": {
233 "description": "The maximum age of a route provided by this connector. (in milliseconds)",
234 "type": "integer",
235 "default": 45000
236 },
237 "routingSecret": {
238 "description": "Seed used for generating routing table auth values.",
239 "type": "string",
240 "default": ""
241 },
242 "backend": {
243 "description": "Name of the backend (can be built-in or a require-able module name). Built-in modules are: ecb, ecb-plus-xrp, ecb-plus-coinmarketcap, one-to-one",
244 "type": "string",
245 "default": "ecb"
246 },
247 "backendConfig": {
248 "description": "Additional configuration for the backend.",
249 "type": "object",
250 "default": {},
251 "additionalProperties": true
252 },
253 "store": {
254 "description": "Name of the store (can be built-in or a require-able module name). Built-in modules are: memory",
255 "type": "string",
256 "default": "memory"
257 },
258 "storePath": {
259 "description": "Shorthand for `config.storeConfig.path`.",
260 "type": "string",
261 "default": ""
262 },
263 "storeConfig": {
264 "description": "Additional options to be passed to the `store`'s constructor.",
265 "type": "object",
266 "default": {},
267 "additionalProperties": true
268 },
269 "middlewares": {
270 "description": "Additional middleware that should be added to the middleware stack.",
271 "type": "object",
272 "additionalProperties": {
273 "description": "Object describing middleware instance.",
274 "type": "object",
275 "properties": {
276 "type": {
277 "description": "NPM module that should be `require`d to load the middleware constructor.",
278 "type": "string"
279 },
280 "options": {
281 "description": "Options that will be passed to the middleware constructor.",
282 "type": "object",
283 "additionalProperties": true
284 }
285 },
286 "required": [
287 "type"
288 ]
289 },
290 "default": {}
291 },
292 "disableMiddleware": {
293 "description": "List of built-in middlewares that should be disabled. Can be used to replace built-in middleware with your own custom version.",
294 "type": "array",
295 "items": {
296 "description": "Name of the middleware to be removed.",
297 "enum": ["errorHandler", "rateLimit", "balance", "maxPacketAmount", "throughput", "deduplicate", "validateFulfillment", "expire", "stats", "alert"]
298 },
299 "default": []
300 },
301 "reflectPayments": {
302 "description": "Whether to allow routing payments back to the account that sent them.",
303 "type": "boolean",
304 "default": true
305 },
306 "initialConnectTimeout": {
307 "description": "How long the connector should wait for account plugins to connect before launching other subsystems. (in milliseconds)",
308 "type": "integer",
309 "default": 10000
310 },
311 "adminApi": {
312 "description": "Whether the admin API is enabled or not. Default: false (disabled)",
313 "type": "boolean",
314 "default": false
315 },
316 "adminApiPort": {
317 "description": "Which port the admin API should listen on. Default: 7780",
318 "type": "integer",
319 "minimum": 0,
320 "maximum": 65535,
321 "default": 7780
322 },
323 "adminApiHost": {
324 "description": "Host to bind to. Warning: The admin API interface should never be made public! Default: '127.0.0.1'",
325 "type": "string",
326 "default": "127.0.0.1"
327 },
328 "collectDefaultMetrics": {
329 "description": "Whether the Prometheus exporter should include system metrics or not. Default: false (no)",
330 "type": "boolean",
331 "default": false
332 }
333 },
334 "required": ["accounts"],
335 "additionalProperties": false
336}