diff --git a/internal/storages/builder/builder.go b/internal/storages/builder/builder.go index c61b0e78..9c57178d 100644 --- a/internal/storages/builder/builder.go +++ b/internal/storages/builder/builder.go @@ -40,9 +40,6 @@ func GetStorage(ctx context.Context, stCfg *domains.StorageConfig, logCgf *domai } return directory.NewStorage(stCfg.Directory) case S3StorageType: - if err := stCfg.S3.Validate(); err != nil { - return nil, fmt.Errorf("s3 storage config validation failed: %w", err) - } return s3.NewStorage(ctx, stCfg.S3, logCgf.Level) } return nil, fmt.Errorf("unknown storage type: %s", stCfg.Type) diff --git a/internal/storages/s3/config.go b/internal/storages/s3/config.go index 84fa1be8..0c5ad765 100644 --- a/internal/storages/s3/config.go +++ b/internal/storages/s3/config.go @@ -14,13 +14,11 @@ package s3 -import ( - "errors" -) - const ( - defaultMaxRetries = 3 - defaultMaxPartSize = 50 * 1024 * 1024 + defaultMaxRetries = 3 + defaultMaxPartSize = 50 * 1024 * 1024 + defaultStorageClass = "STANDARD" + defaultForcePath = true ) type Config struct { @@ -47,16 +45,9 @@ type Config struct { func NewConfig() *Config { return &Config{ - StorageClass: "STANDARD", - ForcePathStyle: true, + StorageClass: defaultStorageClass, + ForcePathStyle: defaultForcePath, MaxRetries: defaultMaxRetries, MaxPartSize: defaultMaxPartSize, } } - -func (c *Config) Validate() error { - if c.Region != "" { - return errors.New("region cannot be empty") - } - return nil -} diff --git a/playground/config.yml b/playground/config.yml index e92dbbc8..9387b026 100644 --- a/playground/config.yml +++ b/playground/config.yml @@ -3,6 +3,7 @@ common: tmp_dir: "/tmp" storage: + type: "s3" s3: endpoint: "http://playground-storage:9000" bucket: "adventureworks"