Skip to content

Commit

Permalink
Update services/blocks, add script to setup db
Browse files Browse the repository at this point in the history
  • Loading branch information
emiliorizzo committed Mar 5, 2020
1 parent 53bc586 commit a773095
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/services/blocks/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,14 @@ config.log = log

startBlocks()

async function startBlocks () {
export async function setupBlocks () {
const setup = await Setup({ log })
await setup.createCollections()
return setup
}

async function startBlocks () {
const setup = await setupBlocks()
const { db, initConfig } = await setup.start()
config.initConfig = initConfig
const Status = new BlocksStatus(db, config)
Expand Down
8 changes: 8 additions & 0 deletions src/services/blocks/setup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { setupBlocks } from './index.js'

setupBlocks().then(() => {
process.exit(0)
}).catch(err => {
console.log(err)
process.exit(9)
})

0 comments on commit a773095

Please sign in to comment.