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

@@ -27,15 +27,16 @@ func (s AliyunRemoteStorageMaker) Make(conf *filer_pb.RemoteConf) (remote_storag
config := &aws.Config{
Endpoint: aws.String(conf.AliyunEndpoint),
Region: aws.String(conf.AliyunRegion),
S3ForcePathStyle: aws.Bool(false),
}
if conf.AliyunAccessKey != "" && conf.AliyunSecretKey != "" {
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 aliyun session: %v", err)
}
client.conn = s3.New(sess)
return client, nil