mirror of
https://github.com/fluencelabs/js-libp2p
synced 2025-06-13 01:01:23 +00:00
fix: improve config defaults (#409)
This removes defaults from superstruct and instead uses mergeOptions to deeply set the defaults on configuration. This ensures that defaults are properly set. This is a step toward removing superstruct altogether, #406, but it is still being used for basic type validation.
This commit is contained in:
@ -125,6 +125,15 @@ describe('configuration', () => {
|
||||
interval: 1000,
|
||||
enabled: true
|
||||
}
|
||||
},
|
||||
dht: {
|
||||
enabled: false
|
||||
},
|
||||
relay: {
|
||||
enabled: true
|
||||
},
|
||||
pubsub: {
|
||||
enabled: true
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -292,6 +301,14 @@ describe('configuration', () => {
|
||||
}
|
||||
},
|
||||
dht: {
|
||||
kBucketSize: 20,
|
||||
enabled: false,
|
||||
randomWalk: {
|
||||
enabled: false,
|
||||
queriesPerPeriod: 1,
|
||||
interval: 300000,
|
||||
timeout: 10000
|
||||
},
|
||||
selectors,
|
||||
validators
|
||||
}
|
||||
|
@ -376,7 +376,7 @@ describe('.pubsub', () => {
|
||||
constructor (node, config) {
|
||||
expect(config).to.be.eql({
|
||||
enabled: true,
|
||||
selfEmit: false,
|
||||
emitSelf: false,
|
||||
signMessages: false,
|
||||
strictSigning: false
|
||||
}).mark()
|
||||
@ -390,7 +390,7 @@ describe('.pubsub', () => {
|
||||
config: {
|
||||
pubsub: {
|
||||
enabled: true,
|
||||
selfEmit: false,
|
||||
emitSelf: false,
|
||||
signMessages: false,
|
||||
strictSigning: false
|
||||
}
|
||||
@ -408,7 +408,7 @@ describe('.pubsub', () => {
|
||||
constructor (node, config) {
|
||||
expect(config).to.be.eql({
|
||||
enabled: true,
|
||||
selfEmit: true,
|
||||
emitSelf: true,
|
||||
signMessages: true,
|
||||
strictSigning: true
|
||||
}).mark()
|
||||
@ -422,7 +422,7 @@ describe('.pubsub', () => {
|
||||
config: {
|
||||
pubsub: {
|
||||
enabled: true,
|
||||
selfEmit: true,
|
||||
emitSelf: true,
|
||||
signMessages: true,
|
||||
strictSigning: true
|
||||
}
|
||||
|
Reference in New Issue
Block a user