We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 7edec8c commit fde6e08Copy full SHA for fde6e08
1 file changed
pkg/sys/env.go
@@ -16,18 +16,23 @@ func (r realEnv) Get(name string) string {
16
return os.Getenv(name)
17
}
18
19
+// RealEnv returns an Env implementation that uses os.Getenv every time Get is called
20
func RealEnv() Env {
21
return realEnv{}
22
23
24
+// FakeEnv is an Env implementation that stores the environment in a map
25
type FakeEnv struct {
26
+ // Envs is the map from which Get calls will look to retrieve environment variables
27
Envs map[string]string
28
29
30
+// NewFakeEnv returns a new FakeEnv with no values in Envs
31
func NewFakeEnv() *FakeEnv {
32
return &FakeEnv{Envs: make(map[string]string)}
33
34
35
+// Get is the Env interface implementation
36
func (f *FakeEnv) Get(name string) string {
37
return f.Envs[name]
38
0 commit comments