Continuing the discussion from `rake uploads:migrate_to_s3` needs some love:
I still can’t get migrate_to_s3
to work with Digital Ocean Spaces.
root@shadrach-rbx8888:/var/www/discourse# rails c
[1] pry(main)> GlobalSetting.use_s3
=> true
[2] pry(main)> GlobalSetting.use_s3?
=> false
[3] pry(main)>
root@shadrach-rbx8888:/var/www/discourse# rake uploads:migrate_to_s3
Migrating uploads to S3 for 'default'...
Please provide the following environment variables
- DISCOURSE_S3_BUCKET
- DISCOURSE_S3_REGION
- DISCOURSE_S3_ACCESS_KEY_ID
- DISCOURSE_S3_SECRET_ACCESS_KEY
root@shadrach-rbx8888:/var/www/discourse# echo $DISCOURSE_S3_BUCKET
lc-rbx
root@shadrach-rbx8888:/var/www/discourse# echo $DISCOURSE_S3_REGION
none
root@shadrach-rbx8888:/var/www/discourse# echo $DISCOURSE_S3_ACCESS_KEY_ID
5-some-other-lettersH
root@shadrach-rbx8888:/var/www/discourse# echo $DISCOURSE_S3_SECRET_ACCESS_KEY
E-some-other-letters-M
root@shadrach-rbx8888:/var/www/discourse#
But here’s where I’m really confused. The latest uploads.rb
cranks up Aws::S3
with just a few environment variables (and not those required for Digital Ocean spaces).
But in blame, at line 248, I see
s3 = Aws::S3::Client.new(S3Helper.s3_options(GlobalSetting))
I don’t understand why a commit from 2 months ago isn’t showing up in tests-passed
. I’m at 04a63cfaaa445f66c2d3d5309191abe9d36c2371
and my uploads.rb
still has the environment variables rather than the GlobalSetting
that I see in blame.
I also can’t quite tell how calling S3Helper.s3_options(GlobalSetting)
can work when s3_upload_bucket
isn’t a global setting. There might be some magic in s3_helper.rb
that i don’t understand that somehow finds the s3_upload bucket, as I see new uploads are going to S3/spaces.