mirror of https://github.com/xwiki-labs/cryptpad
Merge branch 'superboum-bug/create_block_folder_at_boot' into staging
This commit is contained in:
commit
547258b891
13
lib/api.js
13
lib/api.js
|
@ -8,6 +8,7 @@ const Decrees = require("./decrees");
|
||||||
|
|
||||||
const nThen = require("nthen");
|
const nThen = require("nthen");
|
||||||
const Fs = require("fs");
|
const Fs = require("fs");
|
||||||
|
const Fse = require("fs-extra");
|
||||||
const Path = require("path");
|
const Path = require("path");
|
||||||
const Nacl = require("tweetnacl/nacl-fast");
|
const Nacl = require("tweetnacl/nacl-fast");
|
||||||
|
|
||||||
|
@ -40,9 +41,19 @@ nThen(function (w) {
|
||||||
], w(function (err) {
|
], w(function (err) {
|
||||||
if (err) { throw err; }
|
if (err) { throw err; }
|
||||||
}));
|
}));
|
||||||
|
}).nThen(function (w) {
|
||||||
|
Fse.mkdirp(Env.paths.block, w(function (err) {
|
||||||
|
if (err) {
|
||||||
|
log.error("BLOCK_FOLDER_CREATE_FAILED", err);
|
||||||
|
}
|
||||||
|
}));
|
||||||
}).nThen(function (w) {
|
}).nThen(function (w) {
|
||||||
var fullPath = Path.join(Env.paths.block, 'placeholder.txt');
|
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 () {
|
}).nThen(function () {
|
||||||
// asynchronously create a historyKeeper and RPC together
|
// asynchronously create a historyKeeper and RPC together
|
||||||
require('./historyKeeper.js').create(Env, function (err, historyKeeper) {
|
require('./historyKeeper.js').create(Env, function (err, historyKeeper) {
|
||||||
|
|
Loading…
Reference in New Issue