backup: move appConfig to backups table

this is useful for clone also to copy notes, operators, checklist
of the time when the backup was made (as opposed to current)

at this point, it's not clear why we need a archives table. it's
an optimization to not have to store icon for every backup.
This commit is contained in:
Girish Ramakrishnan
2024-12-10 20:52:29 +01:00
parent 98058f600e
commit 41bc08a07e
14 changed files with 58 additions and 38 deletions
+3 -3
View File
@@ -2440,10 +2440,10 @@ async function clone(app, data, user, auditSource) {
const icons = await getIcons(app.id);
// label, icon, checklist intentionally omitted
const dolly = _.pick(app, 'memoryLimit', 'cpuQuota', 'crontab', 'reverseProxyConfig', 'env', 'servicesConfig', 'tags', 'devices',
const dolly = _.pick(backupInfo.appConfig || app, 'memoryLimit', 'cpuQuota', 'crontab', 'reverseProxyConfig', 'env', 'servicesConfig', 'tags', 'devices',
'enableMailbox', 'mailboxDisplayName', 'mailboxName', 'mailboxDomain', 'enableInbox', 'inboxName', 'inboxDomain', 'debugMode',
'enableTurn', 'enableRedis', 'mounts', 'enableBackup', 'enableAutomaticUpdate', 'accessRestriction', 'operators', 'sso',
'notes');
'notes', 'checklist');
if (!manifest.addons?.recvmail) dolly.inboxDomain = null; // needed because we are cloning _current_ app settings with old manifest
@@ -2496,7 +2496,7 @@ async function unarchive(archive, data, auditSource) {
domain = data.domain.toLowerCase(),
overwriteDns = 'overwriteDns' in data ? data.overwriteDns : false;
const appConfig = archive.appConfig;
const appConfig = backup.appConfig;
const { appStoreId, manifest } = appConfig;
let error = validateSecondaryDomains(data.secondaryDomains || {}, manifest);