MCPcopy Create free account
hub / github.com/1Panel-dev/1Panel / normalizeComposeFiles

Function normalizeComposeFiles

agent/app/service/backup_compose.go:387–411  ·  view source on GitHub ↗
(composePath string)

Source from the content-addressed store, hash-verified

385}
386
387func normalizeComposeFiles(composePath string) []string {
388 items := strings.Split(composePath, ",")
389 result := make([]string, 0)
390 seen := make(map[string]struct{})
391 for _, item := range items {
392 item = strings.TrimSpace(item)
393 if item == "" {
394 continue
395 }
396 stat, err := os.Stat(item)
397 if err == nil && stat.IsDir() {
398 item = path.Join(item, "docker-compose.yml")
399 }
400 if _, err := os.Stat(item); err != nil {
401 continue
402 }
403 if _, ok := seen[item]; ok {
404 continue
405 }
406 seen[item] = struct{}{}
407 result = append(result, item)
408 }
409 sort.Strings(result)
410 return result
411}
412
413func (c *composeBackupContext) close() {
414 if c.dockerClient != nil {

Callers 1

loadComposePathAndFilesFunction · 0.85

Calls 2

IsDirMethod · 0.80
StatMethod · 0.45

Tested by

no test coverage detected