1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-23 15:29:42 +02:00

feat(templates): add support for the command field (#585)

This commit is contained in:
Anthony Lapenna 2017-02-10 18:11:00 +13:00 committed by GitHub
parent 9ebe2d96dd
commit d9624053d2
5 changed files with 26 additions and 18 deletions

View file

@ -1,5 +1,5 @@
angular.module('portainer.services')
.factory('TemplateService', ['$q', 'Template', 'TemplateHelper', 'ImageHelper', function TemplateServiceFactory($q, Template, TemplateHelper, ImageHelper) {
.factory('TemplateService', ['$q', 'Template', 'TemplateHelper', 'ImageHelper', 'ContainerHelper', function TemplateServiceFactory($q, Template, TemplateHelper, ImageHelper, ContainerHelper) {
'use strict';
var service = {};
@ -39,9 +39,8 @@ angular.module('portainer.services')
configuration.HostConfig.NetworkMode = network.Name;
configuration.name = containerName;
configuration.Image = template.Image;
if (template.Env) {
configuration.Env = TemplateHelper.EnvToStringArray(template.Env, containerMapping);
}
configuration.Env = TemplateHelper.EnvToStringArray(template.Env, containerMapping);
configuration.Cmd = ContainerHelper.commandStringToArray(template.Command);
var portConfiguration = TemplateHelper.portArrayToPortConfiguration(template.Ports);
configuration.HostConfig.PortBindings = portConfiguration.bindings;
configuration.ExposedPorts = portConfiguration.exposedPorts;