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

Function composeFileExists

agent/app/service/container_compose.go:168–189  ·  view source on GitHub ↗
(workdir, configFile string)

Source from the content-addressed store, hash-verified

166}
167
168func composeFileExists(workdir, configFile string) bool {
169 workdir = strings.TrimSpace(workdir)
170 configFile = strings.TrimSpace(configFile)
171 if configFile == "" {
172 return false
173 }
174 for _, item := range strings.Split(configFile, ",") {
175 file := strings.TrimSpace(item)
176 if file == "" {
177 continue
178 }
179 if !filepath.IsAbs(file) && workdir != "" {
180 file = filepath.Join(workdir, file)
181 }
182 file = filepath.Clean(file)
183 info, err := os.Stat(file)
184 if err == nil && !info.IsDir() {
185 return true
186 }
187 }
188 return false
189}
190
191func (u *ContainerService) TestCompose(req dto.ComposeCreate) (bool, error) {
192 if cmd.CheckIllegal(req.Path) {

Callers 1

PageComposeMethod · 0.85

Calls 3

IsDirMethod · 0.80
CleanMethod · 0.65
StatMethod · 0.45

Tested by

no test coverage detected