mirror of
https://github.com/fluencelabs/js-libp2p
synced 2025-06-25 06:51:32 +00:00
fix: pubsub configuration (#404)
* fix: add pubsub default config (#401) License: MIT Signed-off-by: Matthias Knopp <matthias-knopp@gmx.net> * docs: add default pubsub config to README (#401) License: MIT Signed-off-by: Matthias Knopp <matthias-knopp@gmx.net> * fix: pass config to provided PubSub (#401) License: MIT Signed-off-by: Matthias Knopp <matthias-knopp@gmx.net> * docs: adapt pubsub/example for new config (#401) License: MIT Signed-off-by: Matthias Knopp <matthias-knopp@gmx.net> * Update examples/pubsub/README.md Co-Authored-By: Jacob Heun <jacobheun@gmail.com> * test: add pubsub config tests (#401) License: MIT Signed-off-by: Matthias Knopp <matthias-knopp@gmx.net>
This commit is contained in:
@ -63,7 +63,10 @@ const configSchema = s({
|
||||
// Pubsub config
|
||||
pubsub: s('object?', {
|
||||
// Pubsub defaults
|
||||
enabled: true
|
||||
enabled: true,
|
||||
emitSelf: true,
|
||||
signMessages: true,
|
||||
strictSigning: true
|
||||
})
|
||||
}, {})
|
||||
|
||||
|
@ -124,7 +124,7 @@ class Libp2p extends EventEmitter {
|
||||
|
||||
// start pubsub
|
||||
if (this._modules.pubsub && this._config.pubsub.enabled !== false) {
|
||||
this.pubsub = pubsub(this, this._modules.pubsub)
|
||||
this.pubsub = pubsub(this, this._modules.pubsub, this._config.pubsub)
|
||||
}
|
||||
|
||||
// Attach remaining APIs
|
||||
|
@ -6,8 +6,8 @@ const promisify = require('promisify-es6')
|
||||
|
||||
const errCode = require('err-code')
|
||||
|
||||
module.exports = (node, Pubsub) => {
|
||||
const pubsub = new Pubsub(node, { emitSelf: true })
|
||||
module.exports = (node, Pubsub, config) => {
|
||||
const pubsub = new Pubsub(node, config)
|
||||
|
||||
return {
|
||||
/**
|
||||
|
Reference in New Issue
Block a user