blob: 24fb519ae55ac2d4589ebf27c982c347c23d66c6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
package env
import (
"os"
"strings"
)
func Fetch(key string, defaultValue string) string {
if x := os.Getenv(key); x != "" {
return x
}
return defaultValue
}
func Variables() Vars {
items := Vars{}
for _, line := range os.Environ() {
segments := strings.SplitN(line, "=", 2)
items[segments[0]] = segments[1]
}
return items
}
|