MCPcopy Create free account
hub / github.com/AdRoll/baker / fillDefaults

Method fillDefaults

upload/s3.go:54–90  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

52}
53
54func (cfg *S3Config) fillDefaults() error {
55 if cfg.Region == "" {
56 cfg.Region = "us-east-1"
57 }
58
59 if cfg.Prefix == "" {
60 cfg.Prefix = "/"
61 }
62
63 if cfg.StagingPath == "" {
64 cfg.StagingPath = "/tmp/baker/ologs/staging/"
65 }
66
67 if cfg.SourceBasePath == "" {
68 cfg.SourceBasePath = "/tmp/baker/ologs/"
69 }
70
71 if cfg.Retries < 0 {
72 return fmt.Errorf("retries: invalid number: %v", cfg.Retries)
73 }
74 if cfg.Retries == 0 {
75 cfg.Retries = 3
76 }
77
78 if cfg.Concurrency < 0 {
79 return fmt.Errorf("concurrency: invalid number: %v", cfg.Concurrency)
80 }
81 if cfg.Concurrency == 0 {
82 cfg.Concurrency = 5
83 }
84
85 if cfg.Interval == 0 {
86 cfg.Interval = 15 * time.Second
87 }
88
89 return nil
90}
91
92type S3 struct {
93 Cfg *S3Config

Callers 1

NewS3Function · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected