Backup Service
Summary
In charge of creating and retrieving backup files.
Lifecycle
Reference
- Example usage: DConfig.createBackup (Private)
Cook
Basic
// instantiate backup service
const backupService = new BackupService({ wsRoot });
try {
doBackupStuff();
} finally {
// dispose backup service.
backupService.dispose();
}
Add new backup key
- Add new key in BackupKeyEnum (Private)
- This will be used when retrieving backups and also as the name of the subdirectory it will be stored (e.g.
{wsRoot}/.backup/{key}
)
Changing backup names
- Internally,
BackupService.backup
callsBackupService.generateBackupFileName
to keep backup name formats consistent. - The backup name can have an optional timestamp and infix.
- You can also completely bypass backup file name generation and pass in your own as
nameOverride
if you need more flexibility. - See ../packages/engine-server/src/backup/service.ts (Private) for more.