Allow regions to be set and honored for S3 driver. (#7010)

This is necessary for certain users where
GetBucketLocation API is disabled using IAM
policies. There is a field AmazonS3Region
which we need to re-purpose and use to support
this properly.

Fixes https://github.com/mattermost/platform/issues/6999
Этот коммит содержится в:
Harshavardhana
2017-07-31 09:22:52 -07:00
коммит произвёл Harrison Healey
родитель c506c5cac6
Коммит 489602efe5
5 изменённых файлов: 49 добавлений и 22 удалений

Просмотреть файл

@@ -695,7 +695,8 @@ func TestUserCreateImage(t *testing.T) {
secretKey := utils.Cfg.FileSettings.AmazonS3SecretAccessKey
secure := *utils.Cfg.FileSettings.AmazonS3SSL
signV2 := *utils.Cfg.FileSettings.AmazonS3SignV2
s3Clnt, err := s3New(endpoint, accessKey, secretKey, secure, signV2)
region := utils.Cfg.FileSettings.AmazonS3Region
s3Clnt, err := s3New(endpoint, accessKey, secretKey, secure, signV2, region)
if err != nil {
t.Fatal(err)
}
@@ -800,7 +801,8 @@ func TestUserUploadProfileImage(t *testing.T) {
secretKey := utils.Cfg.FileSettings.AmazonS3SecretAccessKey
secure := *utils.Cfg.FileSettings.AmazonS3SSL
signV2 := *utils.Cfg.FileSettings.AmazonS3SignV2
s3Clnt, err := s3New(endpoint, accessKey, secretKey, secure, signV2)
region := utils.Cfg.FileSettings.AmazonS3Region
s3Clnt, err := s3New(endpoint, accessKey, secretKey, secure, signV2, region)
if err != nil {
t.Fatal(err)
}