| 52 | } |
| 53 | |
| 54 | func (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 | |
| 92 | type S3 struct { |
| 93 | Cfg *S3Config |