-
Notifications
You must be signed in to change notification settings - Fork 0
/
cmd-restore.js
32 lines (23 loc) · 858 Bytes
/
cmd-restore.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
const { BackupTarget, BackupSource, BackupSet, BackupRestore, BackupOptions } = require('./lib');
const { memstats } = require('./lib/debug');
class Restore {
static async exec(args) {
// Parse backup options
const opts = (new BackupOptions({ setname: 'default', sources: [] })).parse(args);
// Configure backup from options
const { destination, verbose, setname, when, filter, output, force, accessKey } = opts;
const target = new BackupTarget({ destination, verbose, accessKey });
await target.connect();
// login
accessKey && await target.login();
// Start the restore
await target.restore({ setname, when, filter, output, force, verbose });
// logout
accessKey && await target.logout();
// cleanup
target.destroy();
// dump memory stats
if (verbose) memstats();
}
};
module.exports = Restore;