diff --git a/gateway/handlers/functionshandler.go b/gateway/handlers/functionshandler.go index 35e28b2b..513bf03a 100644 --- a/gateway/handlers/functionshandler.go +++ b/gateway/handlers/functionshandler.go @@ -198,6 +198,10 @@ func makeSpec(request *requests.CreateFunctionRequest) swarm.ServiceSpec { if len(request.EnvProcess) > 0 { env = append(env, fmt.Sprintf("fprocess=%s", request.EnvProcess)) } + for k, v := range request.EnvVars { + env = append(env, fmt.Sprintf("%s=%s", k, v)) + } + if len(env) > 0 { spec.TaskTemplate.ContainerSpec.Env = env } diff --git a/gateway/requests/requests.go b/gateway/requests/requests.go index e444d2c4..bdda8c25 100644 --- a/gateway/requests/requests.go +++ b/gateway/requests/requests.go @@ -5,9 +5,9 @@ package requests // CreateFunctionRequest create a function in the swarm. type CreateFunctionRequest struct { - Service string `json:"service"` - Image string `json:"image"` - Network string `json:"network"` + Service string `json:"service"` + Image string `json:"image"` + Network string `json:"network"` // EnvProcess corresponds to the fprocess variable for your container watchdog. EnvProcess string `json:"envProcess"`