github.com/bkosm/gompose/v2@v2.3.1/alias.go (about) 1 package gompose 2 3 import ( 4 "os" 5 "time" 6 ) 7 8 // PostgresViaLogs is an alias for a ReadyOrErrChan that checks if a Postgres 9 // instance is ready by checking for a characteristic log entry. 10 func PostgresViaLogs(opts ...Option) ReadyOrErrChan { 11 options := append([]Option{Times(2)}, opts...) 12 return ReadyOnLog("database system is ready to accept connections", options...) 13 } 14 15 // DownOnSignal is an alias for an option that provides a SignalCallback which performs a Down in 16 // case of any system interrupt. 17 // Make sure to provide the CustomFile as a parameter if such is used for Up. 18 func DownOnSignal(opts ...Option) Option { 19 return SignalCallback(func(_ os.Signal) { _ = Down(opts...) }) 20 } 21 22 // Retry is an alias for a RetryCommand with sensible defaults. 23 // It will cause the command to run 3 times with 2 seconds in between before returning an error. 24 func Retry() Option { 25 return RetryCommand(3, time.Second*2) 26 }