From 58a9bc402841ef957f16a1ef786f7cf6656a8ddf Mon Sep 17 00:00:00 2001 From: Marcin Rataj Date: Wed, 17 Jul 2019 10:36:48 +0200 Subject: [PATCH] fix: allow setting Addresses.Delegates (#2253) This PR adds `Addresses.Delegates` (added in https://github.com/ipfs/js-ipfs/pull/2195) as an optional array to the schema used for config validation. It fixes the error below: ![2019-07-12--21-00-53](https://user-images.githubusercontent.com/157609/61152758-92e00180-a4e9-11e9-8ef1-c6c1200575ee.png) ps. I tested it in Brave (embedded js-ipfs + preload nodes) and delegated DHT queries produce expected responses :ok_hand: > ![2019-07-12--21-27-35](https://user-images.githubusercontent.com/157609/61153580-eeab8a00-a4eb-11e9-9152-0dcb51e2a67d.png) > ![2019-07-12--21-27-52](https://user-images.githubusercontent.com/157609/61153579-eeab8a00-a4eb-11e9-8478-71f68d3330d4.png) License: MIT Signed-off-by: Marcin Rataj --- src/core/config.js | 1 + test/core/config.spec.js | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/src/core/config.js b/src/core/config.js index 2fb66bb558..422b92fef9 100644 --- a/src/core/config.js +++ b/src/core/config.js @@ -53,6 +53,7 @@ const configSchema = s({ config: optional(s({ API: 'object?', Addresses: optional(s({ + Delegates: optional(s(['multiaddr'])), Swarm: optional(s(['multiaddr'])), API: 'multiaddr?', Gateway: 'multiaddr' diff --git a/test/core/config.spec.js b/test/core/config.spec.js index 4ce3ffab05..65abe05e5b 100644 --- a/test/core/config.spec.js +++ b/test/core/config.spec.js @@ -144,6 +144,10 @@ describe('config', () => { { config: { Bootstrap: ['/ip4/104.236.176.52/tcp/4001/ipfs/QmSoLnSGccFuZQJzRadHn95W2CrSFmZuTdDWP8HXaHca9z'] } }, { config: { Bootstrap: [] } }, + { config: { Addresses: { Delegates: ['/dns4/node0.preload.ipfs.io/tcp/443/https'] } } }, + { config: { Addresses: { Delegates: [] } } }, + { config: { Addresses: { Delegates: undefined } } }, + { config: undefined } ]