FIX: Use ENV values instead of 'S3Helper.s3_options' in migrate_to_s3
This commit makes the rake task operational for all regions for s3. If we declare s3_endpoint as https://s3.amazonaws.com while
creating an instance of Aws::S3::Client, head_bucket fails for all s3 regions apart from us-east-1. The commit manually defines all
parameters for Aws::S3::Client apart from s3_endpoint to bypass this problem make this task usable for AWS S3.
Removing s3_endpoint from the payload means that custom endpoints like Minio/DO Spaces for will not work in the meantime and we'll
have to add support for a custom `s3_endpoint` in the future.
This commit follows up on 60790eb0
.
This commit is contained in:
parent
90823eaca6
commit
97e17fe084
|
@ -244,14 +244,18 @@ def migrate_to_s3
|
|||
exit 3
|
||||
end
|
||||
|
||||
bucket_has_folder_path = true if GlobalSetting.s3_bucket.include? "/"
|
||||
s3 = Aws::S3::Client.new(S3Helper.s3_options(GlobalSetting))
|
||||
bucket_has_folder_path = true if ENV["DISCOURSE_S3_BUCKET"].include? "/"
|
||||
|
||||
s3 = Aws::S3::Client.new(
|
||||
region: ENV["DISCOURSE_S3_REGION"],
|
||||
access_key_id: ENV["DISCOURSE_S3_ACCESS_KEY_ID"],
|
||||
secret_access_key: ENV["DISCOURSE_S3_SECRET_ACCESS_KEY"])
|
||||
|
||||
if bucket_has_folder_path
|
||||
bucket, folder = S3Helper.get_bucket_and_folder_path(GlobalSetting.s3_bucket)
|
||||
bucket, folder = S3Helper.get_bucket_and_folder_path(ENV["DISCOURSE_S3_BUCKET"])
|
||||
folder = File.join(folder, "/")
|
||||
else
|
||||
bucket, folder = GlobalSetting.s3_bucket, ""
|
||||
bucket, folder = ENV["DISCOURSE_S3_BUCKET"], ""
|
||||
end
|
||||
|
||||
begin
|
||||
|
|
Loading…
Reference in New Issue