Skip to content

Commit

Permalink
fix: disable dht by default #338 (#339)
Browse files Browse the repository at this point in the history
fix: correct transport config check
  • Loading branch information
jacobheun authored Mar 20, 2019
1 parent da52af7 commit e52ce66
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
8 changes: 6 additions & 2 deletions src/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@ const optionsSchema = s(
peerDiscovery: optional(list([s('object|function')])),
peerRouting: optional(list(['object'])),
streamMuxer: optional(list([s('object|function')])),
transport: list([transport])
transport: s.intersection([[transport], s.interface({
length (v) {
return v > 0 ? true : 'ERROR_EMPTY'
}
})])
}),
config: s({
peerDiscovery: 'object?',
Expand All @@ -52,7 +56,7 @@ const optionsSchema = s(
}, { enabled: false, queriesPerPeriod: 1, interval: 30000, timeout: 10000 })),
validators: 'object?',
selectors: 'object?'
}, { enabled: true, kBucketSize: 20, enabledDiscovery: true }),
}, { enabled: false, kBucketSize: 20, enabledDiscovery: false }),
EXPERIMENTAL: s({
pubsub: 'boolean'
}, { pubsub: false })
Expand Down
10 changes: 5 additions & 5 deletions test/config.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ describe('configuration', () => {
transport: [ ]
}
})
}).to.throw()
}).to.throw('ERROR_EMPTY')
})

it('should add defaults to missing items', () => {
Expand Down Expand Up @@ -95,7 +95,7 @@ describe('configuration', () => {
},
dht: {
kBucketSize: 20,
enabled: true,
enabled: false,
randomWalk: {
enabled: false,
queriesPerPeriod: 1,
Expand Down Expand Up @@ -152,8 +152,8 @@ describe('configuration', () => {
transport: [ WS ]
},
config: {
EXPERIMENTAL: {
dht: true
dht: {
enabled: true
}
}
}
Expand Down Expand Up @@ -197,7 +197,7 @@ describe('configuration', () => {
},
dht: {
kBucketSize: 20,
enabled: true,
enabled: false,
randomWalk: {
enabled: false,
queriesPerPeriod: 1,
Expand Down

0 comments on commit e52ce66

Please sign in to comment.