44 "context"
55 "fmt"
66 "os"
7+ "time"
78
89 "github.com/stackvista/stackstate-backup-cli/internal/clients/clickhouse"
910 "github.com/stackvista/stackstate-backup-cli/internal/clients/elasticsearch"
@@ -16,15 +17,16 @@ import (
1617
1718// Context holds all dependencies for cli commands
1819type Context struct {
19- K8sClient * k8s.Client
20- Namespace string
21- S3Client s3.Interface
22- ESClient elasticsearch.Interface
23- CHClient clickhouse.Interface
24- Config * config.Config
25- Logger * logger.Logger
26- Formatter * output.Formatter
27- Context context.Context
20+ K8sClient * k8s.Client
21+ Namespace string
22+ S3Client s3.Interface
23+ ESClient elasticsearch.Interface
24+ CHClient clickhouse.Interface
25+ Config * config.Config
26+ Logger * logger.Logger
27+ Formatter * output.Formatter
28+ Context context.Context
29+ JobTimeout time.Duration
2830}
2931
3032// NewContext creates production dependencies
@@ -68,14 +70,15 @@ func NewContext(flags *config.CLIGlobalFlags) (*Context, error) {
6870 formatter := output .NewFormatter (os .Stdout , flags .OutputFormat )
6971
7072 return & Context {
71- K8sClient : k8sClient ,
72- Namespace : flags .Namespace ,
73- Config : cfg ,
74- S3Client : s3Client ,
75- ESClient : esClient ,
76- CHClient : chClient ,
77- Logger : logger .New (flags .Quiet , flags .Debug ),
78- Formatter : formatter ,
79- Context : context .Background (),
73+ K8sClient : k8sClient ,
74+ Namespace : flags .Namespace ,
75+ Config : cfg ,
76+ S3Client : s3Client ,
77+ ESClient : esClient ,
78+ CHClient : chClient ,
79+ Logger : logger .New (flags .Quiet , flags .Debug ),
80+ Formatter : formatter ,
81+ Context : context .Background (),
82+ JobTimeout : time .Duration (flags .JobTimeout ) * time .Minute ,
8083 }, nil
8184}
0 commit comments