clone: also clone crontab, enableTurn, enableRedis etc
This commit is contained in:
+7
-15
@@ -2271,7 +2271,7 @@ async function clone(app, data, user, auditSource) {
|
||||
const backupInfo = await backups.get(backupId);
|
||||
|
||||
if (!backupInfo) throw new BoxError(BoxError.NOT_FOUND, 'Backup not found');
|
||||
if (!backupInfo.manifest) throw new BoxError(BoxError.EXTERNAL_ERROR, 'Could not get restore config');
|
||||
if (!backupInfo.manifest) throw new BoxError(BoxError.EXTERNAL_ERROR, 'Could not detect restore manifest');
|
||||
if (backupInfo.encryptionVersion === 1) throw new BoxError(BoxError.BAD_FIELD, 'This encrypted backup was created with an older Cloudron version and cannot be cloned');
|
||||
|
||||
const manifest = backupInfo.manifest, appStoreId = app.appStoreId;
|
||||
@@ -2303,29 +2303,21 @@ async function clone(app, data, user, auditSource) {
|
||||
|
||||
const icons = await getIcons(app.id);
|
||||
|
||||
const obj = {
|
||||
const dolly = _.pick(app, 'memoryLimit', 'cpuShares', 'crontab', 'reverseProxyConfig', 'env', 'servicesConfig', 'tags',
|
||||
'enableMailbox', 'mailboxDisplayName', 'mailboxName', 'mailboxDomain', 'enableInbox', 'inboxName', 'inboxDomain',
|
||||
'enableTurn', 'enableRedis', 'mounts', 'enableBackup', 'enableAutomaticUpdate', 'accessRestriction', 'operators', 'sso');
|
||||
|
||||
const obj = Object.assign(dolly, {
|
||||
installationState: exports.ISTATE_PENDING_CLONE,
|
||||
runState: exports.RSTATE_RUNNING,
|
||||
memoryLimit: app.memoryLimit,
|
||||
cpuShares: app.cpuShares,
|
||||
accessRestriction: app.accessRestriction,
|
||||
sso: !!app.sso,
|
||||
mailboxName,
|
||||
mailboxDomain,
|
||||
enableBackup: app.enableBackup,
|
||||
reverseProxyConfig: app.reverseProxyConfig,
|
||||
env: app.env,
|
||||
secondaryDomains,
|
||||
redirectDomains: [],
|
||||
aliasDomains: [],
|
||||
servicesConfig: app.servicesConfig,
|
||||
label: app.label ? `${app.label}-clone` : '',
|
||||
tags: app.tags,
|
||||
enableAutomaticUpdate: app.enableAutomaticUpdate,
|
||||
icon: icons.icon,
|
||||
enableMailbox: app.enableMailbox,
|
||||
mailboxDisplayName: app.mailboxDisplayName
|
||||
};
|
||||
});
|
||||
|
||||
const [addError] = await safe(add(newAppId, appStoreId, manifest, subdomain, domain, newPortBindings, obj));
|
||||
if (addError && addError.reason === BoxError.ALREADY_EXISTS) throw getDuplicateErrorDetails(addError.message, locations, newPortBindings);
|
||||
|
||||
Reference in New Issue
Block a user