From 97107c4ef756629a44cedd1203f2ae9a92cc3974 Mon Sep 17 00:00:00 2001 From: Leask Wong Date: Tue, 31 Aug 2021 05:51:14 -0400 Subject: [PATCH] chore: update datastore usage in CONFIGURATION.md (#982) Co-authored-by: Vasco Santos --- doc/CONFIGURATION.md | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/doc/CONFIGURATION.md b/doc/CONFIGURATION.md index 135390eb..e64c257b 100644 --- a/doc/CONFIGURATION.md +++ b/doc/CONFIGURATION.md @@ -1,4 +1,4 @@ -# Configuration +# - [Configuration](#configuration) - [Overview](#overview) @@ -503,6 +503,9 @@ const MPLEX = require('libp2p-mplex') const { NOISE } = require('libp2p-noise') const LevelStore = require('datastore-level') +const datastore = new LevelStore('path/to/store') +await datastore.open() + const node = await Libp2p.create({ modules: { transport: [TCP], @@ -511,7 +514,7 @@ const node = await Libp2p.create({ }, keychain: { pass: 'notsafepassword123456789', - datastore: new LevelStore('path/to/store') + datastore: dsInstant, } }) @@ -673,16 +676,18 @@ const Libp2p = require('libp2p') const TCP = require('libp2p-tcp') const MPLEX = require('libp2p-mplex') const { NOISE } = require('libp2p-noise') - const LevelStore = require('datastore-level') +const datastore = new LevelStore('path/to/store') +const dsInstant = await datastore.open() + const node = await Libp2p.create({ modules: { transport: [TCP], streamMuxer: [MPLEX], connEncryption: [NOISE] }, - datastore: new LevelStore('path/to/store'), + datastore: dsInstant, peerStore: { persistence: true, threshold: 5