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

Function loadFileObjectConfig

cli/compose/loader/loader.go:649–676  ·  view source on GitHub ↗
(name string, objType string, obj types.FileObjectConfig, details types.ConfigDetails)

Source from the content-addressed store, hash-verified

647}
648
649func loadFileObjectConfig(name string, objType string, obj types.FileObjectConfig, details types.ConfigDetails) (types.FileObjectConfig, error) {
650 // if "external: true"
651 switch {
652 case obj.External.External:
653 // handle deprecated external.name
654 if obj.External.Name != "" {
655 if obj.Name != "" {
656 return obj, fmt.Errorf("%[1]s %[2]s: %[1]s.external.name and %[1]s.name conflict; only use %[1]s.name", objType, name)
657 }
658 if versions.GreaterThanOrEqualTo(details.Version, "3.5") {
659 logrus.Warnf("%[1]s %[2]s: %[1]s.external.name is deprecated in favor of %[1]s.name", objType, name)
660 }
661 obj.Name = obj.External.Name
662 obj.External.Name = ""
663 } else if obj.Name == "" {
664 obj.Name = name
665 }
666 // if not "external: true"
667 case obj.Driver != "":
668 if obj.File != "" {
669 return obj, fmt.Errorf("%[1]s %[2]s: %[1]s.driver and %[1]s.file conflict; only use %[1]s.driver", objType, name)
670 }
671 default:
672 obj.File = absPath(details.WorkingDir, obj.File)
673 }
674
675 return obj, nil
676}
677
678func absPath(workingDir string, filePath string) string {
679 if filepath.IsAbs(filePath) {

Callers 2

LoadSecretsFunction · 0.85
LoadConfigObjsFunction · 0.85

Calls 1

absPathFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…