MCPcopy Index your code
hub / github.com/jetify-com/devbox / OSExpandEnvMap

Function OSExpandEnvMap

internal/conf/env.go:10–30  ·  view source on GitHub ↗
(env, existingEnv map[string]string, projectDir string)

Source from the content-addressed store, hash-verified

8)
9
10func OSExpandEnvMap(env, existingEnv map[string]string, projectDir string) map[string]string {
11 mapperfunc := func(value string) string {
12 // Special variables that should return correct value
13 switch value {
14 case "PWD":
15 return projectDir
16 }
17
18 // in case existingEnv is nil
19 if existingEnv == nil {
20 return ""
21 }
22 return existingEnv[value]
23 }
24
25 res := map[string]string{}
26 for k, v := range env {
27 res[k] = os.Expand(v, mapperfunc)
28 }
29 return res
30}

Callers 1

configEnvsMethod · 0.92

Calls

no outgoing calls

Tested by

no test coverage detected