MCPcopy
hub / github.com/keploy/keploy / findComposeFile

Function findComposeFile

pkg/client/app/util.go:68–94  ·  view source on GitHub ↗
(cmd string)

Source from the content-addressed store, hash-verified

66}
67
68func findComposeFile(cmd string) []string {
69
70 cmdArgs := strings.Fields(cmd)
71 composePaths := []string{}
72 haveMultipleComposeFiles := false
73
74 for i := 0; i < len(cmdArgs); i++ {
75 if cmdArgs[i] == "-f" && i+1 < len(cmdArgs) {
76 composePaths = append(composePaths, cmdArgs[i+1])
77 haveMultipleComposeFiles = true
78 }
79 }
80
81 if haveMultipleComposeFiles {
82 return composePaths
83 }
84
85 filenames := []string{"docker-compose.yml", "docker-compose.yaml", "compose.yml", "compose.yaml"}
86
87 for _, filename := range filenames {
88 if _, err := os.Stat(filename); !os.IsNotExist(err) {
89 return []string{filename}
90 }
91 }
92
93 return []string{}
94}
95
96func modifyDockerComposeCommand(appCmd, newComposeFile, appComposePath, appServiceName string) string {
97 // Ensure newComposeFile starts with ./

Callers 1

SetupComposeMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected