mirror of
https://github.com/Luzifer/vault2env.git
synced 2024-12-30 00:51:19 +00:00
Fix: Added godeps
This commit is contained in:
parent
56afabf057
commit
2679c1403f
1 changed files with 26 additions and 0 deletions
26
vendor/github.com/Luzifer/go_helpers/env/env.go
generated
vendored
Normal file
26
vendor/github.com/Luzifer/go_helpers/env/env.go
generated
vendored
Normal file
|
@ -0,0 +1,26 @@
|
|||
package env
|
||||
|
||||
import "strings"
|
||||
|
||||
// ListToMap converts a list of strings in format KEY=VALUE into a map
|
||||
func ListToMap(list []string) map[string]string {
|
||||
out := map[string]string{}
|
||||
for _, entry := range list {
|
||||
if len(entry) == 0 || entry[0] == '#' {
|
||||
continue
|
||||
}
|
||||
|
||||
parts := strings.SplitN(entry, "=", 2)
|
||||
out[parts[0]] = strings.Trim(parts[1], "\"")
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
// MapToList converts a map into a list of strings in format KEY=VALUE
|
||||
func MapToList(envMap map[string]string) []string {
|
||||
out := []string{}
|
||||
for k, v := range envMap {
|
||||
out = append(out, k+"="+v)
|
||||
}
|
||||
return out
|
||||
}
|
Loading…
Reference in a new issue