mirror of
https://github.com/fluencelabs/js-libp2p
synced 2025-06-17 19:21:22 +00:00
feat: add datastore to config
This commit is contained in:
@ -7,6 +7,7 @@ const ModuleSchema = Joi.alternatives().try(Joi.func(), Joi.object())
|
||||
const OptionsSchema = Joi.object({
|
||||
// TODO: create proper validators for the generics
|
||||
connectionManager: Joi.object(),
|
||||
datastore: Joi.object(),
|
||||
peerInfo: Joi.object().required(),
|
||||
peerBook: Joi.object(),
|
||||
modules: Joi.object().keys({
|
||||
|
@ -41,6 +41,7 @@ class Node extends EventEmitter {
|
||||
// and add default values where appropriate
|
||||
_options = validateConfig(_options)
|
||||
|
||||
this.datastore = _options.datastore
|
||||
this.peerInfo = _options.peerInfo
|
||||
this.peerBook = _options.peerBook || new PeerBook()
|
||||
|
||||
@ -100,9 +101,7 @@ class Node extends EventEmitter {
|
||||
this._dht = new DHT(this._switch, {
|
||||
kBucketSize: this._config.dht.kBucketSize || 20,
|
||||
enabledDiscovery,
|
||||
// TODO make datastore an option of libp2p itself so
|
||||
// that other things can use it as well
|
||||
datastore: dht.datastore
|
||||
datastore: this.datastore
|
||||
})
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user