Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed broken S3 storage after structure refactoring #52

Merged
merged 2 commits into from
Apr 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions internal/storages/builder/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
21 changes: 6 additions & 15 deletions internal/storages/s3/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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
}
1 change: 1 addition & 0 deletions playground/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ common:
tmp_dir: "/tmp"

storage:
type: "s3"
s3:
endpoint: "http://playground-storage:9000"
bucket: "adventureworks"
Expand Down