diff --git a/pkg/config/config.go b/pkg/config/config.go index aa269fe..73550a3 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -89,7 +89,7 @@ type S3ServerConfig struct { // S3ServerSetup describes initial configuration for an S3 server/bucket type S3ServerSetup struct { - CreateBucket bool `json:"create_bucket" yaml:"create_bucket"` + Bucket bool `json:"bucket" yaml:"bucket"` CORS bool `json:"cors" yaml:"cors"` Lifecycle bool `json:"lifecycle" yaml:"ifecycle"` AbortIncompleteUploads int `json:"abort_incomplete_uploads" yaml:"abort_incomplete_uploads"` @@ -177,8 +177,8 @@ func NewConfig(configFile string) (*Config, error) { cfg.SetDefault("no_ssl", false) cfg.SetDefault("access_key", "") cfg.SetDefault("secret_key", "") - cfg.SetDefault("create_bucket", true) cfg.SetDefault("implementation", "") + cfg.SetDefault("setup.bucket", true) cfg.SetDefault("setup.cors", true) cfg.SetDefault("setup.lifecycle", true) cfg.SetDefault("setup.abort_incomplete_uploads", 31) diff --git a/pkg/server/setup.go b/pkg/server/setup.go index 672a39f..36b68a8 100644 --- a/pkg/server/setup.go +++ b/pkg/server/setup.go @@ -28,7 +28,7 @@ func (s *Server) Setup() error { if _, err := s.GetBucketPolicy(&s3.GetBucketPolicyInput{ Bucket: aws.String(s.Config.Bucket), }); err != nil { - if aerr, ok := err.(awserr.Error); ok && aerr.Code() == s3.ErrCodeNoSuchBucket && s.Config.Setup.CreateBucket { + if aerr, ok := err.(awserr.Error); ok && aerr.Code() == s3.ErrCodeNoSuchBucket && s.Config.Setup.Bucket { if _, err := s.CreateBucket(&s3.CreateBucketInput{ Bucket: aws.String(s.Config.Bucket), }); err != nil {