mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
17 lines
412 B
Go
17 lines
412 B
Go
|
package libcontainerd
|
||
|
|
||
|
import "strings"
|
||
|
|
||
|
// setupEnvironmentVariables convert a string array of environment variables
|
||
|
// into a map as required by the HCS. Source array is in format [v1=k1] [v2=k2] etc.
|
||
|
func setupEnvironmentVariables(a []string) map[string]string {
|
||
|
r := make(map[string]string)
|
||
|
for _, s := range a {
|
||
|
arr := strings.Split(s, "=")
|
||
|
if len(arr) == 2 {
|
||
|
r[arr[0]] = arr[1]
|
||
|
}
|
||
|
}
|
||
|
return r
|
||
|
}
|