MCPcopy
hub / github.com/docker/compose / BaseEnvironment

Method BaseEnvironment

pkg/e2e/framework.go:266–286  ·  view source on GitHub ↗

BaseEnvironment provides the minimal environment variables used across all Docker / Compose commands.

()

Source from the content-addressed store, hash-verified

264// BaseEnvironment provides the minimal environment variables used across all
265// Docker / Compose commands.
266func (c *CLI) BaseEnvironment() []string {
267 env := []string{
268 "HOME=" + c.HomeDir,
269 "USER=" + os.Getenv("USER"),
270 "DOCKER_CONFIG=" + c.ConfigDir,
271 "KUBECONFIG=invalid",
272 "PATH=" + os.Getenv("PATH"),
273 }
274 dockerContextEnv, ok := os.LookupEnv("DOCKER_CONTEXT")
275 if ok {
276 env = append(env, "DOCKER_CONTEXT="+dockerContextEnv)
277 }
278
279 if coverdir, ok := os.LookupEnv("GOCOVERDIR"); ok {
280 _, filename, _, _ := runtime.Caller(0)
281 root := filepath.Join(filepath.Dir(filename), "..", "..")
282 coverdir = filepath.Join(root, coverdir)
283 env = append(env, fmt.Sprintf("GOCOVERDIR=%s", coverdir))
284 }
285 return env
286}
287
288// NewCmd creates a cmd object configured with the test environment set
289func (c *CLI) NewCmd(command string, args ...string) icmd.Cmd {

Callers 2

NewCmdMethod · 0.95
NewCmdWithEnvMethod · 0.95

Calls 1

DirMethod · 0.45

Tested by

no test coverage detected