Create the block folder at boot
This commit is contained in:
parent
5979aafdee
commit
51e6136a58
1 changed files with 12 additions and 1 deletions
13
lib/api.js
13
lib/api.js
|
@ -5,6 +5,7 @@ const Decrees = require("./decrees");
|
|||
|
||||
const nThen = require("nthen");
|
||||
const Fs = require("fs");
|
||||
const Fse = require("fs-extra");
|
||||
const Path = require("path");
|
||||
|
||||
module.exports.create = function (Env) {
|
||||
|
@ -21,9 +22,19 @@ nThen(function (w) {
|
|||
console.error(err);
|
||||
}
|
||||
}));
|
||||
}).nThen(function (w) {
|
||||
Fse.mkdirp(Env.paths.block, w(function (err) {
|
||||
if (err) {
|
||||
log.error("BLOCK_FOLDER_CREATE_FAILED", err);
|
||||
}
|
||||
}));
|
||||
}).nThen(function (w) {
|
||||
var fullPath = Path.join(Env.paths.block, 'placeholder.txt');
|
||||
Fs.writeFile(fullPath, 'PLACEHOLDER\n', w());
|
||||
Fs.writeFile(fullPath, 'PLACEHOLDER\n', w(function (err) {
|
||||
if (err) {
|
||||
log.error('BLOCK_PLACEHOLDER_CREATE_FAILED', err);
|
||||
}
|
||||
}));
|
||||
}).nThen(function () {
|
||||
// asynchronously create a historyKeeper and RPC together
|
||||
require('./historyKeeper.js').create(Env, function (err, historyKeeper) {
|
||||
|
|
Loading…
Reference in a new issue