rework backup root

notes:
* backup root cannot come from backend. for dynamic mounts backend cannot know where it is mounted
* backupConfig is 3 parts - format / mount / password . there is also this rootPath (which should not be in db)
* password should be stored separately in settings at some point
* format has to be passed along everywhere because we allow restore from  same backupConfig but different format. we do this by saving the format in the backups table

fixes #819
This commit is contained in:
Girish Ramakrishnan
2023-08-15 20:24:54 +05:30
parent da49a69562
commit aa8c23c8b3
14 changed files with 94 additions and 154 deletions

View File

@@ -53,14 +53,14 @@ describe('Storage', function () {
done();
});
it('fails to set backup config for bad folder', async function () {
it('fails to set backup storage for bad folder', async function () {
const tmp = Object.assign({}, gBackupConfig, { backupFolder: '/root/oof' });
const [error] = await safe(backups.setConfig(tmp));
const [error] = await safe(backups.setStorage(tmp));
expect(error.reason).to.equal(BoxError.BAD_FIELD);
});
it('succeeds to set backup config', async function () {
await backups.setConfig(gBackupConfig);
it('succeeds to set backup storage', async function () {
await backups.setStorage(gBackupConfig);
expect(fs.existsSync(path.join(gBackupConfig.backupFolder, 'snapshot'))).to.be(true); // auto-created
});