cloudron 5.7.1 → 5.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/actions.js +22 -17
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cloudron",
3
- "version": "5.7.1",
3
+ "version": "5.8.1",
4
4
  "license": "MIT",
5
5
  "description": "Cloudron Commandline Tool",
6
6
  "main": "main.js",
package/src/actions.js CHANGED
@@ -609,27 +609,27 @@ async function install(localOptions, cmd) {
609
609
  }
610
610
 
611
611
  // port bindings
612
- let portBindings = {};
612
+ let ports = {};
613
613
  if (options.portBindings) {
614
614
  // ask the user for port values if the ports are different in the app and the manifest
615
615
  if (typeof options.portBindings === 'string') {
616
- portBindings = { };
616
+ ports = { };
617
617
  options.portBindings.split(',').forEach(function (kv) {
618
618
  const tmp = kv.split('=');
619
619
  if (isNaN(parseInt(tmp[1], 10))) return; // disable the port
620
- portBindings[tmp[0]] = parseInt(tmp[1], 10);
620
+ ports[tmp[0]] = parseInt(tmp[1], 10);
621
621
  });
622
622
  } else {
623
- portBindings = queryPortBindings(null /* existing app */, manifest);
623
+ ports = queryPortBindings(null /* existing app */, manifest);
624
624
  }
625
625
  } else { // just put in defaults
626
626
  const allPorts = _.extend({}, manifest.tcpPorts, manifest.udpPorts);
627
627
  for (const portName in allPorts) {
628
- portBindings[portName] = allPorts[portName].defaultValue;
628
+ ports[portName] = allPorts[portName].defaultValue;
629
629
  }
630
630
  }
631
631
 
632
- for (const binding in portBindings) console.log(`Port ${binding}: ${portBindings[binding]}`);
632
+ for (const port in ports) console.log(`Port ${port}: ${ports[port]}`);
633
633
 
634
634
  const data = {
635
635
  appStoreId: options.appstoreId || '', // note case change
@@ -639,7 +639,7 @@ async function install(localOptions, cmd) {
639
639
  domain: domainObject.domain,
640
640
  secondaryDomains,
641
641
  aliasDomains,
642
- portBindings,
642
+ ports,
643
643
  accessRestriction: null
644
644
  };
645
645
 
@@ -707,11 +707,16 @@ async function configure(localOptions, cmd) {
707
707
  }
708
708
  }
709
709
 
710
+ const ports = {};
711
+ for (const portName in app.portBindings) {
712
+ ports[portName] = app.portBindings[portName].hostPort;
713
+ }
714
+
710
715
  const data = {
711
716
  location: domainObject.subdomain, // LEGACY
712
717
  subdomain: domainObject.subdomain,
713
718
  domain: domainObject.domain,
714
- portBindings: app.portBindings,
719
+ ports,
715
720
  secondaryDomains,
716
721
  aliasDomains
717
722
  };
@@ -734,24 +739,24 @@ async function configure(localOptions, cmd) {
734
739
 
735
740
  // port bindings
736
741
  if (options.portBindings) {
737
- let portBindings = app.portBindings;
742
+ let ports = app.portBindings;
738
743
  // ask the user for port values if the ports are different in the app and the manifest
739
744
  if (typeof options.portBindings === 'string') {
740
- portBindings = {};
745
+ ports = {};
741
746
  options.portBindings.split(',').forEach(function (kv) {
742
747
  const tmp = kv.split('=');
743
748
  if (isNaN(parseInt(tmp[1], 10))) return; // disable the port
744
- portBindings[tmp[0]] = parseInt(tmp[1], 10);
749
+ ports[tmp[0]] = parseInt(tmp[1], 10);
745
750
  });
746
751
  } else {
747
- portBindings = queryPortBindings(app, app.manifest);
752
+ ports = queryPortBindings(app, app.manifest);
748
753
  }
749
754
 
750
- for (const binding in portBindings) {
751
- console.log('%s: %s', binding, portBindings[binding]);
755
+ for (const port in ports) {
756
+ console.log('%s: %s', port, ports[port]);
752
757
  }
753
758
 
754
- data.portBindings = portBindings;
759
+ data.ports = portBindings;
755
760
  }
756
761
 
757
762
  const request = createRequest('POST', `/api/v1/apps/${app.id}/configure/location`, options);
@@ -1258,7 +1263,7 @@ async function clone(localOptions, cmd) {
1258
1263
 
1259
1264
  const location = options.location || readlineSync.question('Cloned app location: ', {});
1260
1265
  const secondaryDomains = await querySecondaryDomains(app, app.manifest, options);
1261
- const portBindings = queryPortBindings(app, app.manifest);
1266
+ const ports = queryPortBindings(app, app.manifest);
1262
1267
  const backupId = options.backup;
1263
1268
 
1264
1269
  const domainObject = await selectDomain(location, options);
@@ -1268,7 +1273,7 @@ async function clone(localOptions, cmd) {
1268
1273
  subdomain: domainObject.subdomain,
1269
1274
  domain: domainObject.domain,
1270
1275
  secondaryDomains,
1271
- portBindings
1276
+ ports
1272
1277
  };
1273
1278
  const request = createRequest('POST', `/api/v1/apps/${app.id}/clone`, options);
1274
1279
  const response = await request.send(data);