Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

Commit

Permalink
fix: allow setting Addresses.Delegates (#2253)
Browse files Browse the repository at this point in the history
This PR adds `Addresses.Delegates` (added in  #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 👌 

> ![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 <lidel@lidel.org>
  • Loading branch information
lidel authored and Alan Shaw committed Jul 17, 2019
1 parent 7fa867e commit 58a9bc4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/core/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
4 changes: 4 additions & 0 deletions test/core/config.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
]

Expand Down

0 comments on commit 58a9bc4

Please sign in to comment.