Skip to content

Commit

Permalink
add NewBucketWithConfig for cos objstore (#5076)
Browse files Browse the repository at this point in the history
Signed-off-by: nickzhwang <[email protected]>

Co-authored-by: nickzhwang <[email protected]>
  • Loading branch information
Nicholaswang and nickzhwang authored Jan 19, 2022
1 parent ba9b36d commit 78d250b
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pkg/objstore/cos/cos.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,11 +127,18 @@ func NewBucket(logger log.Logger, conf []byte, component string) (*Bucket, error
if err != nil {
return nil, errors.Wrap(err, "parsing cos configuration")
}

return NewBucketWithConfig(logger, config, component)
}

// NewBucketWithConfig returns a new Bucket using the provided cos config values.
func NewBucketWithConfig(logger log.Logger, config Config, component string) (*Bucket, error) {
if err := config.validate(); err != nil {
return nil, errors.Wrap(err, "validate cos configuration")
}

var bucketURL *url.URL
var err error
if config.Endpoint != "" {
bucketURL, err = url.Parse(config.Endpoint)
if err != nil {
Expand Down

0 comments on commit 78d250b

Please sign in to comment.