feat(backup): add containerarchive-backed backup storage, restore, download, and pruning support
This commit is contained in:
@@ -53,12 +53,8 @@ export class BackupsHandler {
|
||||
'restoreBackup',
|
||||
async (dataArg) => {
|
||||
await requireValidIdentity(this.opsServerRef.adminHandler, dataArg);
|
||||
const backupPath = this.opsServerRef.oneboxRef.backupManager.getBackupFilePath(dataArg.backupId);
|
||||
if (!backupPath) {
|
||||
throw new plugins.typedrequest.TypedResponseError('Backup file not found');
|
||||
}
|
||||
const rawResult = await this.opsServerRef.oneboxRef.backupManager.restoreBackup(
|
||||
backupPath,
|
||||
dataArg.backupId,
|
||||
dataArg.options,
|
||||
);
|
||||
return {
|
||||
@@ -84,14 +80,11 @@ export class BackupsHandler {
|
||||
if (!backup) {
|
||||
throw new plugins.typedrequest.TypedResponseError('Backup not found');
|
||||
}
|
||||
const filePath = this.opsServerRef.oneboxRef.backupManager.getBackupFilePath(dataArg.backupId);
|
||||
if (!filePath) {
|
||||
throw new plugins.typedrequest.TypedResponseError('Backup file not found');
|
||||
}
|
||||
// Return a download URL that the client can fetch directly
|
||||
const filename = backup.filename || `${backup.serviceName}-${backup.createdAt}.tar.enc`;
|
||||
return {
|
||||
downloadUrl: `/api/backups/${dataArg.backupId}/download`,
|
||||
filename: backup.filename,
|
||||
filename,
|
||||
};
|
||||
},
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user