Paired-backup verifier now checks more than the manifest hash
This commit is contained in:
@@ -2,7 +2,7 @@ import { createCoordinatedCustodyBackup, verifyCoordinatedCustodyBackup } from '
|
||||
|
||||
const [action, ...args] = process.argv.slice(2);
|
||||
if (action !== 'create' && action !== 'verify') throw new Error('Expected create or verify');
|
||||
const allowed = new Set(['--source', '--destination', '--consent']);
|
||||
const allowed = new Set(['--source', '--destination', '--consent', '--pg-restore-binary']);
|
||||
for (let index = 0; index < args.length; index++) {
|
||||
if (!allowed.has(args[index]) || (args[index] !== '--consent' && (!args[index + 1] || args[index + 1].startsWith('--')))) {
|
||||
throw new Error('Invalid coordinated backup arguments');
|
||||
@@ -19,8 +19,8 @@ try {
|
||||
if (!destination || !args.includes('--consent')) throw new Error('Create requires --destination and explicit --consent');
|
||||
result = await createCoordinatedCustodyBackup(source, destination);
|
||||
} else {
|
||||
if (value('--destination') || args.includes('--consent')) throw new Error('Verify accepts only --source');
|
||||
result = await verifyCoordinatedCustodyBackup(source);
|
||||
if (value('--destination') || args.includes('--consent')) throw new Error('Verify accepts --source and optional --pg-restore-binary');
|
||||
result = await verifyCoordinatedCustodyBackup(source, value('--pg-restore-binary'));
|
||||
}
|
||||
console.log(JSON.stringify(result, null, 2));
|
||||
} catch {
|
||||
|
||||
Reference in New Issue
Block a user