backups: add remotePath

the main motivation is that id can be used in REST API routes. previously,
the id was a path and this had a "/" in it. This made /api/v1/backups/:backupId
not work.
This commit is contained in:
Girish Ramakrishnan
2022-04-04 14:13:27 -07:00
parent 54934c41a7
commit 452a4d9a75
15 changed files with 234 additions and 157 deletions

View File

@@ -2,7 +2,10 @@
'use strict';
if (process.argv[2] === '--check') return console.log('OK');
if (process.argv[2] === '--check') {
console.log('OK');
process.exit(0);
}
const assert = require('assert'),
async = require('async'),
@@ -22,11 +25,11 @@ function initialize(callback) {
}
// Main process starts here
const backupId = process.argv[2];
const remotePath = process.argv[2];
const format = process.argv[3];
const dataLayoutString = process.argv[4];
debug(`Backing up ${dataLayoutString} to ${backupId}`);
debug(`Backing up ${dataLayoutString} to ${remotePath}`);
process.on('SIGTERM', function () {
process.exit(0);
@@ -73,7 +76,7 @@ initialize(function (error) {
dumpMemoryInfo();
const timerId = setInterval(dumpMemoryInfo, 30000);
backuptask.upload(backupId, format, dataLayoutString, throttledProgressCallback(5000), function resultHandler(error) {
backuptask.upload(remotePath, format, dataLayoutString, throttledProgressCallback(5000), function resultHandler(error) {
debug('upload completed. error: ', error);
process.send({ result: error ? error.message : '' });