github.com/vshn/k8ify@v1.1.2-0.20240502214202-6c9ed3ef0bf4/pkg/util/osutils.go (about) 1 package util 2 3 import ( 4 "os" 5 "strings" 6 ) 7 8 func GetEnv() map[string]string { 9 env := make(map[string]string) 10 for _, e := range os.Environ() { 11 pair := strings.SplitN(e, "=", 2) 12 env[pair[0]] = pair[1] 13 } 14 return env 15 } 16 17 func GetEnvValueCaseInsensitive(caseInsensitiveKey string) string { 18 for k, v := range GetEnv() { 19 if strings.EqualFold(k, caseInsensitiveKey) { 20 return v 21 } 22 } 23 return "" 24 }