Skip to content
This repository was archived by the owner on Nov 27, 2023. It is now read-only.

Commit c9a2d0c

Browse files
committed
Fix ipfs node not initialized correctly
1 parent 36cb067 commit c9a2d0c

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/factory/ipfs-local.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ async function api_factory(ipfs_opts, orbitdb_dir, orbitdb_opts) {
1111
EXPERIMENTAL: {
1212
pubsub: true
1313
},
14+
start: true,
1415
config: {
1516
Addresses: {
1617
Swarm: [
@@ -22,7 +23,12 @@ async function api_factory(ipfs_opts, orbitdb_dir, orbitdb_opts) {
2223
}
2324

2425
ipfs_opts = Object.assign(ipfs_defaults, ipfs_opts)
25-
ipfs = new Ipfs(ipfs_opts)
26+
ipfs = await new Promise((resolve, reject) => {
27+
var node = new Ipfs(ipfs_opts)
28+
node.on("ready", () => {
29+
resolve(node)
30+
})
31+
}).catch((ex) => raise (ex))
2632
orbitdb = await OrbitDB.createInstance(ipfs, orbitdb_dir, orbitdb_opts)
2733
dbm = new DBManager(orbitdb)
2834
orbitdb_api = new OrbitApi(dbm)

0 commit comments

Comments
 (0)