blob: aa767b2e5886c64f9306bc3340d239e4dc2df32e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
package container
import (
endure "github.com/spiral/endure/pkg/container"
)
// NewContainer creates endure container with all required options (based on container Config). Logger is nil by
// default.
func NewContainer(cfg Config) (*endure.Endure, error) {
endureOptions := []endure.Options{
endure.SetLogLevel(cfg.LogLevel),
endure.RetryOnFail(cfg.RetryOnFail),
endure.GracefulShutdownTimeout(cfg.GracePeriod),
}
if cfg.PrintGraph {
endureOptions = append(endureOptions, endure.Visualize(endure.StdOut, ""))
}
return endure.NewContainer(nil, endureOptions...)
}
|