the noop backend is migrated into 0 sites config. when the updater code sees that there is no site to backup, it will just fail. user has to manually update with skipBackup flag.
29 lines
677 B
JavaScript
29 lines
677 B
JavaScript
'use strict';
|
|
|
|
exports = module.exports = {
|
|
api,
|
|
validateFormat,
|
|
};
|
|
|
|
const assert = require('node:assert'),
|
|
BoxError = require('./boxerror.js');
|
|
|
|
function api(format) {
|
|
assert.strictEqual(typeof format, 'string');
|
|
|
|
switch (format) {
|
|
case 'tgz': return require('./backupformat/tgz.js');
|
|
case 'rsync': return require('./backupformat/rsync.js');
|
|
}
|
|
|
|
throw new BoxError(BoxError.INTERNAL_ERROR, `Undefined format ${format}`);
|
|
}
|
|
|
|
function validateFormat(format) {
|
|
assert.strictEqual(typeof format, 'string');
|
|
|
|
if (format === 'tgz' || format == 'rsync') return null;
|
|
|
|
return new BoxError(BoxError.BAD_FIELD, 'Invalid backup format');
|
|
}
|