diff --git a/src/services/blocks/index.js b/src/services/blocks/index.js index 4f6bf6af..b2d3f177 100644 --- a/src/services/blocks/index.js +++ b/src/services/blocks/index.js @@ -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) diff --git a/src/services/blocks/setup.js b/src/services/blocks/setup.js new file mode 100644 index 00000000..d3c666ae --- /dev/null +++ b/src/services/blocks/setup.js @@ -0,0 +1,8 @@ +import { setupBlocks } from './index.js' + +setupBlocks().then(() => { + process.exit(0) +}).catch(err => { + console.log(err) + process.exit(9) +})