forked from
tangled.org/core
fork
Configure Feed
Select the types of activity you want to include in your feed.
Monorepo for Tangled
fork
Configure Feed
Select the types of activity you want to include in your feed.
1package engine
2
3import (
4 "fmt"
5)
6
7type EnvVars []string
8
9// ConstructEnvs converts a tangled.Pipeline_Step_Environment_Elem.{Key,Value}
10// representation into a docker-friendly []string{"KEY=value", ...} slice.
11func ConstructEnvs(envs map[string]string) EnvVars {
12 var dockerEnvs EnvVars
13 for k, v := range envs {
14 ev := fmt.Sprintf("%s=%s", k, v)
15 dockerEnvs = append(dockerEnvs, ev)
16 }
17 return dockerEnvs
18}
19
20// Slice returns the EnvVar as a []string slice.
21func (ev EnvVars) Slice() []string {
22 return ev
23}
24
25// AddEnv adds a key=value string to the EnvVar.
26func (ev *EnvVars) AddEnv(key, value string) {
27 *ev = append(*ev, fmt.Sprintf("%s=%s", key, value))
28}