summaryrefslogtreecommitdiff
path: root/container/container.go
diff options
context:
space:
mode:
Diffstat (limited to 'container/container.go')
-rw-r--r--container/container.go20
1 files changed, 20 insertions, 0 deletions
diff --git a/container/container.go b/container/container.go
new file mode 100644
index 00000000..610fdbf9
--- /dev/null
+++ b/container/container.go
@@ -0,0 +1,20 @@
+package container
+
+import (
+ endure "github.com/roadrunner-server/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.GracefulShutdownTimeout(cfg.GracePeriod),
+ }
+
+ if cfg.PrintGraph {
+ endureOptions = append(endureOptions, endure.Visualize(endure.StdOut, ""))
+ }
+
+ return endure.NewContainer(nil, endureOptions...)
+}