Skip to content

Commit

Permalink
fix(backup): restore directory fails to create
Browse files Browse the repository at this point in the history
  • Loading branch information
polonel committed Jan 9, 2019
1 parent 605c8d8 commit d68a045
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/backup/restore.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,8 @@ var spawn = require('child_process').spawn;
var os = require('os');
var async = require('async');
var AdmZip = require('adm-zip');
var archiver = require('archiver');
var database = require('../database');
var winston = require('winston');
var moment = require('moment');

global.env = process.env.NODE_ENV || 'production';

Expand Down Expand Up @@ -97,9 +95,9 @@ function runRestore(file, callback) {
});

mongodump.on('exit', function(code) {
if (code === 0) {
if (code === 0)
callback(null, 'done');
} else
else
callback(new Error('MongoDump falied with code ' + code));
});
}
Expand Down Expand Up @@ -129,6 +127,9 @@ function runRestore(file, callback) {
}

databaseName = database.db.connection.db.databaseName;

fs.ensureDirSync(path.join(__dirname, '../../restores'));

async.series([
function(next) {
// Clean any old restores hanging around
Expand Down

0 comments on commit d68a045

Please sign in to comment.