github.com/bkosm/gompose/v2@v2.3.1/readyonlog.go (about)

     1  package gompose
     2  
     3  import "os/exec"
     4  
     5  // ReadyOnLog returns a ReadyOrErrChan that is ready when the specified log message is found in the
     6  // aggregated logs of all composed services.
     7  // This function proxies the responsibility to ReadyOnStdout by providing it the output of compose logs.
     8  // Can be configured with CustomFile to read from custom compose spec.
     9  func ReadyOnLog(awaiting string, opts ...Option) ReadyOrErrChan {
    10  	var customFile customFile
    11  	for _, opt := range opts {
    12  		if fn := opt.withCustomFileFunc; fn != nil {
    13  			fn(&customFile)
    14  		}
    15  	}
    16  
    17  	var args []string
    18  	if customFile != "" {
    19  		args = []string{"-f", string(customFile)}
    20  	}
    21  	args = append(args, "logs")
    22  
    23  	return ReadyOnStdout(
    24  		exec.Command("docker-compose", args...),
    25  		awaiting,
    26  		opts...,
    27  	)
    28  }