Add backup download route if backend supports it

This commit is contained in:
Johannes Zellner
2016-09-16 18:14:36 +02:00
parent c9c1964e09
commit 6352064e6c
7 changed files with 74 additions and 2 deletions

View File

@@ -5,6 +5,7 @@ exports = module.exports = {
getAppBackupDetails: getAppBackupDetails,
getRestoreUrl: getRestoreUrl,
getLocalFilePath: getLocalFilePath,
copyObject: copyObject
};
@@ -56,6 +57,16 @@ function getRestoreUrl(apiConfig, filename, callback) {
callback(null, { url: restoreUrl });
}
function getLocalFilePath(apiConfig, filename, callback) {
assert.strictEqual(typeof apiConfig, 'object');
assert.strictEqual(typeof filename, 'string');
assert.strictEqual(typeof callback, 'function');
var backupFolder = apiConfig.backupFolder || FALLBACK_BACKUP_FOLDER;
callback(null, { filePath: path.join(backupFolder, filename) });
}
function copyObject(apiConfig, from, to, callback) {
assert.strictEqual(typeof apiConfig, 'object');
assert.strictEqual(typeof from, 'string');