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

Function recreateCompose

agent/app/service/container_compose.go:436–450  ·  view source on GitHub ↗
(content, path string)

Source from the content-addressed store, hash-verified

434}
435
436func recreateCompose(content, path string) error {
437 file, err := os.OpenFile(path, os.O_WRONLY|os.O_TRUNC, 0640)
438 if err != nil {
439 return err
440 }
441 defer file.Close()
442 write := bufio.NewWriter(file)
443 _, _ = write.WriteString(content)
444 write.Flush()
445
446 if stdout, err := compose.Up(path); err != nil {
447 return errors.New(string(stdout))
448 }
449 return nil
450}
451
452func loadEnv(list []dto.ComposeInfo) []dto.ComposeInfo {
453 for i := 0; i < len(list); i++ {

Callers 1

ComposeUpdateMethod · 0.85

Calls 3

OpenFileMethod · 0.80
CloseMethod · 0.65
FlushMethod · 0.45

Tested by

no test coverage detected