1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-22 06:49:40 +02:00

Added ENV variables to container start.

This commit is contained in:
Kevan Ahlquist 2015-01-20 01:42:08 -06:00
parent 76d7e280f9
commit 4d22a04484
4 changed files with 68 additions and 6 deletions

View file

@ -7,7 +7,7 @@ function($scope, $routeParams, $location, Container, Messages) {
memory: 0,
memorySwap: 0,
cpuShares: 1024,
env: '',
env: [],
commands: '',
volumesFrom: '',
portBindings: []
@ -28,6 +28,10 @@ function($scope, $routeParams, $location, Container, Messages) {
var loc = $location;
var s = $scope;
var env = $scope.config.env.map(function(envar) {
return envar.name + '=' + envar.value;
});
var exposedPorts = {};
var portBindings = {};
// TODO: consider using compatibility library
@ -57,6 +61,7 @@ function($scope, $routeParams, $location, Container, Messages) {
CpuShares: $scope.config.cpuShares,
Cmd: cmds,
VolumesFrom: $scope.config.volumesFrom,
Env: env,
ExposedPorts: exposedPorts,
HostConfig: {
PortBindings: portBindings
@ -90,4 +95,13 @@ function($scope, $routeParams, $location, Container, Messages) {
var idx = $scope.config.portBindings.indexOf(portBinding);
$scope.config.portBindings.splice(idx, 1);
};
$scope.addEnv = function() {
$scope.config.env.push({name: '', value: ''});
};
$scope.removeEnv = function(envar) {
var idx = $scope.config.env.indexOf(envar);
$scope.config.env.splice(idx, 1);
};
}]);