chore: update datastore usage in CONFIGURATION.md (#982)

Co-authored-by: Vasco Santos <vasco.santos@ua.pt>
This commit is contained in:
Leask Wong 2021-08-31 05:51:14 -04:00 committed by Vasco Santos
parent d3f78edffe
commit 97107c4ef7

View File

@ -1,4 +1,4 @@
# Configuration #
- [Configuration](#configuration) - [Configuration](#configuration)
- [Overview](#overview) - [Overview](#overview)
@ -503,6 +503,9 @@ const MPLEX = require('libp2p-mplex')
const { NOISE } = require('libp2p-noise') const { NOISE } = require('libp2p-noise')
const LevelStore = require('datastore-level') const LevelStore = require('datastore-level')
const datastore = new LevelStore('path/to/store')
await datastore.open()
const node = await Libp2p.create({ const node = await Libp2p.create({
modules: { modules: {
transport: [TCP], transport: [TCP],
@ -511,7 +514,7 @@ const node = await Libp2p.create({
}, },
keychain: { keychain: {
pass: 'notsafepassword123456789', pass: 'notsafepassword123456789',
datastore: new LevelStore('path/to/store') datastore: dsInstant,
} }
}) })
@ -673,16 +676,18 @@ const Libp2p = require('libp2p')
const TCP = require('libp2p-tcp') const TCP = require('libp2p-tcp')
const MPLEX = require('libp2p-mplex') const MPLEX = require('libp2p-mplex')
const { NOISE } = require('libp2p-noise') const { NOISE } = require('libp2p-noise')
const LevelStore = require('datastore-level') const LevelStore = require('datastore-level')
const datastore = new LevelStore('path/to/store')
const dsInstant = await datastore.open()
const node = await Libp2p.create({ const node = await Libp2p.create({
modules: { modules: {
transport: [TCP], transport: [TCP],
streamMuxer: [MPLEX], streamMuxer: [MPLEX],
connEncryption: [NOISE] connEncryption: [NOISE]
}, },
datastore: new LevelStore('path/to/store'), datastore: dsInstant,
peerStore: { peerStore: {
persistence: true, persistence: true,
threshold: 5 threshold: 5