system: take multiple backup targets into account

This commit is contained in:
Girish Ramakrishnan
2025-07-25 08:45:11 +02:00
parent 69cd766f88
commit d559df3ee3
+12 -11
View File
@@ -125,18 +125,19 @@ async function getFilesystems() {
filesystems[diskInfo.filesystem].contents.push(stdPath);
}
const backupConfig = await backupTargets.getConfig();
if (backupConfig.provider === 'filesystem') {
const [, dfResult] = await safe(df.file(backupConfig.backupFolder));
const filesystem = dfResult?.filesystem || rootDisk.filesystem;
if (filesystems[filesystem]) filesystems[filesystem].contents.push({ type: 'standard', id: 'cloudron-backup', path: backupConfig.backupFolder });
}
for (const backupTarget of await backupTargets.list(1, 100)) {
if (backupTarget.provider === 'filesystem') {
const [, dfResult] = await safe(df.file(backupTarget.config.backupFolder));
const filesystem = dfResult?.filesystem || rootDisk.filesystem;
if (filesystems[filesystem]) filesystems[filesystem].contents.push({ type: 'cloudron-backup', id: backupTarget.id, path: backupTarget.config.backupFolder });
}
// often the default backup dir is not cleaned up
if (backupConfig.provider !== 'filesystem' || backupConfig.backupFolder !== paths.DEFAULT_BACKUP_DIR) {
const [, dfResult] = await safe(df.file(paths.DEFAULT_BACKUP_DIR));
const filesystem = dfResult?.filesystem || rootDisk.filesystem;
if (filesystems[filesystem]) filesystems[filesystem].contents.push({ type: 'cloudron-backup-default', id: 'cloudron-backup-default', path: paths.DEFAULT_BACKUP_DIR });
// often the default backup dir is not cleaned up
if (backupTarget.provider !== 'filesystem' || backupTarget.config.backupFolder !== paths.DEFAULT_BACKUP_DIR) {
const [, dfResult] = await safe(df.file(paths.DEFAULT_BACKUP_DIR));
const filesystem = dfResult?.filesystem || rootDisk.filesystem;
if (filesystems[filesystem]) filesystems[filesystem].contents.push({ type: 'cloudron-backup-default', id: 'cloudron-backup-default', path: paths.DEFAULT_BACKUP_DIR });
}
}
const [dockerError, dockerInfo] = await safe(docker.info());