Skip to content

Commit

Permalink
🐧 Add use legacy list flag
Browse files Browse the repository at this point in the history
Signed-off-by: Rintaro Okamura <rintaro.okamura@gmail.com>
  • Loading branch information
rinx committed May 19, 2020
1 parent f2e0675 commit bd77569
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions internal/config/blob.go
Expand Up @@ -58,6 +58,7 @@ type S3Config struct {
AccessKey string `json:"access_key" yaml:"access_key"`
SecretAccessKey string `json:"secret_access_key" yaml:"secret_access_key"`
Token string `json:"token" yaml:"token"`
UseLegacyList bool `json:"use_legacy_list" yaml:"use_legacy_list"`
}

func (b *Blob) Bind() *Blob {
Expand Down
6 changes: 6 additions & 0 deletions internal/db/storage/blob/s3/option.go
Expand Up @@ -51,3 +51,9 @@ func WithToken(tk string) Option {
s.token = tk
}
}

func WithUseLegacyList(flg bool) Option {
return func(s *sess) {
s.useLegacyList = flg
}
}
3 changes: 2 additions & 1 deletion internal/db/storage/blob/s3/s3.go
Expand Up @@ -31,6 +31,7 @@ type sess struct {
accessKey string
secretAccessKey string
token string
useLegacyList bool
}

type Session interface {
Expand Down Expand Up @@ -68,7 +69,7 @@ func (s *sess) URLOpener() (*URLOpener, error) {
return &URLOpener{
ConfigProvider: session,
Options: s3blob.Options{
UseLegacyList: false,
UseLegacyList: s.useLegacyList,
},
}, nil
}

0 comments on commit bd77569

Please sign in to comment.