cloud drive: add support for Baidu BOS

This commit is contained in:
Chris Lu
2021-08-24 23:46:33 -07:00
parent 2d805beed4
commit a7a914f120
8 changed files with 268 additions and 152 deletions

View File

@@ -29,11 +29,13 @@ func (s TencentRemoteStorageMaker) Make(conf *filer_pb.RemoteConf) (remote_stora
Endpoint: aws.String(conf.TencentEndpoint),
S3ForcePathStyle: aws.Bool(true),
}
config.Credentials = credentials.NewStaticCredentials(accessKey, secretKey, "")
if accessKey != "" && secretKey != "" {
config.Credentials = credentials.NewStaticCredentials(accessKey, secretKey, "")
}
sess, err := session.NewSession(config)
if err != nil {
return nil, fmt.Errorf("create aws session: %v", err)
return nil, fmt.Errorf("create tencent session: %v", err)
}
client.conn = s3.New(sess)
return client, nil