Split options into another method so that plugins can use it.

This commit is contained in:
Guo Xiang Tan 2016-08-15 22:04:24 +08:00
parent 205be0d044
commit 1916924304

View File

@ -66,7 +66,7 @@ class S3Helper
path path
end end
def s3_resource def s3_options
opts = { region: SiteSetting.s3_region } opts = { region: SiteSetting.s3_region }
unless SiteSetting.s3_use_iam_profile unless SiteSetting.s3_use_iam_profile
@ -74,7 +74,11 @@ class S3Helper
opts[:secret_access_key] = SiteSetting.s3_secret_access_key opts[:secret_access_key] = SiteSetting.s3_secret_access_key
end end
Aws::S3::Resource.new(opts) opts
end
def s3_resource
Aws::S3::Resource.new(s3_options)
end end
def s3_bucket def s3_bucket