MCPcopy Create free account
hub / github.com/docker/cli / resolveEnvironment

Function resolveEnvironment

cli/compose/loader/loader.go:463–484  ·  view source on GitHub ↗
(serviceConfig *types.ServiceConfig, workingDir string, lookupEnv template.Mapping)

Source from the content-addressed store, hash-verified

461}
462
463func resolveEnvironment(serviceConfig *types.ServiceConfig, workingDir string, lookupEnv template.Mapping) error {
464 environment := make(map[string]*string)
465
466 if len(serviceConfig.EnvFile) > 0 {
467 var envVars []string
468
469 for _, file := range serviceConfig.EnvFile {
470 filePath := absPath(workingDir, file)
471 fileVars, err := parseEnvFile(filePath)
472 if err != nil {
473 return err
474 }
475 envVars = append(envVars, fileVars...)
476 }
477 updateEnvironment(environment,
478 opts.ConvertKVStringsToMapWithNil(envVars), lookupEnv)
479 }
480
481 updateEnvironment(environment, serviceConfig.Environment, lookupEnv)
482 serviceConfig.Environment = environment
483 return nil
484}
485
486func resolveVolumePaths(volumes []types.ServiceVolumeConfig, workingDir string, lookupEnv template.Mapping) error {
487 for i, volume := range volumes {

Callers 1

LoadServiceFunction · 0.85

Calls 3

absPathFunction · 0.85
parseEnvFileFunction · 0.85
updateEnvironmentFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…