AppendProjectEnvToCmdEnv converts a key-value pair map into a slice of `key=value`s allow module definition to use an alternative env-var-name than field while apply
(envMap map[string]string, envList []string, translationMap map[string]string)
| 143 | // AppendProjectEnvToCmdEnv converts a key-value pair map into a slice of `key=value`s |
| 144 | // allow module definition to use an alternative env-var-name than field while apply |
| 145 | func AppendProjectEnvToCmdEnv(envMap map[string]string, envList []string, translationMap map[string]string) []string { |
| 146 | |
| 147 | for key, val := range envMap { |
| 148 | if val != "" { |
| 149 | // overwrite key if exist in translation map |
| 150 | if val, ok := translationMap[key]; ok { |
| 151 | key = val |
| 152 | } |
| 153 | envList = append(envList, fmt.Sprintf("%s=%s", key, val)) |
| 154 | } |
| 155 | } |
| 156 | return envList |
| 157 | } |
| 158 | |
| 159 | // IndentString will Add x space char padding at the beginging of each line. |
| 160 | func IndentString(content string, spaces int) string { |
no outgoing calls
no test coverage detected