Forward portCount during the portBinding translation
This commit is contained in:
+9
-6
@@ -272,7 +272,8 @@ function translatePortBindings(portBindings, manifest) {
|
||||
|
||||
for (let portName in portBindings) {
|
||||
const portType = portName in tcpPorts ? exports.PORT_TYPE_TCP : exports.PORT_TYPE_UDP;
|
||||
result[portName] = { hostPort: portBindings[portName], type: portType, portCount: portBindings[portName].portCount || 1 };
|
||||
const portCount = portBindings[portName].portCount || (portName in tcpPorts ? manifest.tcpPorts[portName].portCount : manifest.udpPorts[portName].portCount);
|
||||
result[portName] = { hostPort: portBindings[portName], type: portType, portCount: portCount || 1 };
|
||||
}
|
||||
|
||||
return result;
|
||||
@@ -1286,7 +1287,7 @@ async function install(data, auditSource) {
|
||||
|
||||
const subdomain = data.subdomain.toLowerCase(),
|
||||
domain = data.domain.toLowerCase(),
|
||||
portBindings = translatePortBindings(data.portBindings || null, manifest),
|
||||
portBindings = translatePortBindings(data.portBindings || null, data.manifest),
|
||||
accessRestriction = data.accessRestriction || null,
|
||||
memoryLimit = data.memoryLimit || 0,
|
||||
debugMode = data.debugMode || null,
|
||||
@@ -2256,7 +2257,7 @@ async function clone(app, data, user, auditSource) {
|
||||
|
||||
const subdomain = data.subdomain.toLowerCase(),
|
||||
domain = data.domain.toLowerCase(),
|
||||
portBindings = translatePortBindings(data.portBindings, manifest),
|
||||
portBindings = data.portBindings || null,
|
||||
backupId = data.backupId,
|
||||
overwriteDns = 'overwriteDns' in data ? data.overwriteDns : false,
|
||||
skipDnsSetup = 'skipDnsSetup' in data ? data.skipDnsSetup : false,
|
||||
@@ -2275,6 +2276,8 @@ async function clone(app, data, user, auditSource) {
|
||||
|
||||
const manifest = backupInfo.manifest, appStoreId = app.appStoreId;
|
||||
|
||||
const newPortBindings = translatePortBindings(data.portBindings, manifest);
|
||||
|
||||
let error = validateSecondaryDomains(data.secondaryDomains || {}, manifest);
|
||||
if (error) throw error;
|
||||
const secondaryDomains = translateSecondaryDomains(data.secondaryDomains || {});
|
||||
@@ -2289,7 +2292,7 @@ async function clone(app, data, user, auditSource) {
|
||||
error = checkManifestConstraints(manifest);
|
||||
if (error) throw error;
|
||||
|
||||
error = validatePortBindings(portBindings, manifest);
|
||||
error = validatePortBindings(newPortBindings, manifest);
|
||||
if (error) throw error;
|
||||
|
||||
// should we copy the original app's mailbox settings instead?
|
||||
@@ -2324,8 +2327,8 @@ async function clone(app, data, user, auditSource) {
|
||||
mailboxDisplayName: app.mailboxDisplayName
|
||||
};
|
||||
|
||||
const [addError] = await safe(add(newAppId, appStoreId, manifest, subdomain, domain, portBindings, obj));
|
||||
if (addError && addError.reason === BoxError.ALREADY_EXISTS) throw getDuplicateErrorDetails(addError.message, locations, portBindings);
|
||||
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);
|
||||
if (addError) throw addError;
|
||||
|
||||
await purchaseApp({ appId: newAppId, appstoreId: app.appStoreId, manifestId: manifest.id || 'customapp' });
|
||||
|
||||
Reference in New Issue
Block a user