Make UDP ports configurable

Part of cloudron/box#504
This commit is contained in:
Girish Ramakrishnan
2018-08-13 08:38:47 -07:00
parent 31a62313bb
commit 6c574ead94
2 changed files with 12 additions and 11 deletions
+4 -4
View File
@@ -51,7 +51,7 @@ angular.module('Application').controller('AppsController', ['$scope', '$location
$scope.appConfigure.app = app;
$scope.appConfigure.location = app.location;
$scope.appConfigure.domain = $scope.domains.filter(function (d) { return d.domain === app.domain; })[0];
$scope.appConfigure.portBindingsInfo = app.manifest.tcpPorts || {}; // Portbinding map only for information
$scope.appConfigure.portBindingsInfo = angular.extend({}, app.manifest.tcpPorts, app.manifest.udpPorts); // Portbinding map only for information
$scope.appConfigure.memoryLimit = app.memoryLimit || app.manifest.memoryLimit || (256 * 1024 * 1024);
$scope.appConfigure.xFrameOptions = app.xFrameOptions.indexOf('ALLOW-FROM') === 0 ? app.xFrameOptions.split(' ')[1] : '';
$scope.appConfigure.alternateDomainEnabled = !!app.alternateDomains[0];
@@ -275,10 +275,10 @@ angular.module('Application').controller('AppsController', ['$scope', '$location
$scope.appRestore.busyFetching = true;
$scope.appRestore.domain = $scope.domains.find(function (d) { return app.domain === d.domain; }); // pre-select the app's domain
$scope.appRestore.portBindingsInfo = $scope.appRestore.app.manifest.tcpPorts || {}; // Portbinding map only for information
$scope.appRestore.portBindingsInfo = angular.extend({}, $scope.appRestore.app.manifest.tcpPorts, $scope.appRestore.app.manifest.udpPorts); // Portbinding map only for information
// set default ports
for (var env in $scope.appRestore.app.manifest.tcpPorts) {
$scope.appRestore.portBindings[env] = $scope.appRestore.app.manifest.tcpPorts[env].defaultValue || 0;
for (var env in $scope.appRestore.portBindingsInfo) {
$scope.appRestore.portBindings[env] = $scope.appRestore.portBindingsInfo[env].defaultValue || 0;
$scope.appRestore.portBindingsEnabled[env] = true;
}
+8 -7
View File
@@ -105,7 +105,7 @@ angular.module('Application').controller('AppStoreController', ['$scope', '$loca
$scope.appInstall.mediaLinks = $scope.appInstall.app.manifest.mediaLinks || [];
$scope.appInstall.domain = $scope.domains.find(function (d) { return $scope.config.adminDomain === d.domain; }); // pre-select the adminDomain
$scope.appInstall.portBindingsInfo = $scope.appInstall.app.manifest.tcpPorts || {}; // Portbinding map only for information
$scope.appInstall.portBindingsInfo = angular.extend({}, $scope.appInstall.app.manifest.tcpPorts, $scope.appInstall.app.manifest.udpPorts); // Portbinding map only for information
$scope.appInstall.portBindings = {}; // This is the actual model holding the env:port pair
$scope.appInstall.portBindingsEnabled = {}; // This is the actual model holding the enabled/disabled flag
@@ -115,18 +115,19 @@ angular.module('Application').controller('AppStoreController', ['$scope', '$loca
// for spaces users, the User management is hidden. thus the admin flag check
if (!$scope.user.admin) {
// just install it with access restriction as just the user
var me = $scope.users.find(function (u) { return u.id === $scope.user.id; });
$scope.appInstall.accessRestrictionOption = 'groups';
$scope.appInstall.accessRestriction = { users: [ me ], groups: [] };
// just install it with access restriction as just the user
var me = $scope.users.find(function (u) { return u.id === $scope.user.id; });
$scope.appInstall.accessRestrictionOption = 'groups';
$scope.appInstall.accessRestriction = { users: [ me ], groups: [] };
} else {
$scope.appInstall.accessRestrictionOption = 'any';
$scope.appInstall.accessRestriction = { users: [], groups: [] };
}
// set default ports
for (var env in $scope.appInstall.app.manifest.tcpPorts) {
$scope.appInstall.portBindings[env] = $scope.appInstall.app.manifest.tcpPorts[env].defaultValue || 0;
var allPorts = angular.extend({}, $scope.appInstall.app.manifest.tcpPorts, $scope.appInstall.app.manifest.udpPorts);
for (var env in allPorts) {
$scope.appInstall.portBindings[env] = allPorts[env].defaultValue || 0;
$scope.appInstall.portBindingsEnabled[env] = true;
}