Skip to content

Commit

Permalink
Merge pull request #175 from loftwah/dl/rake-take-fix-quick
Browse files Browse the repository at this point in the history
sigh lol
  • Loading branch information
loftwah authored Sep 18, 2024
2 parents 9def84c + b142717 commit a75b4fc
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/tasks/migrate_images_to_spaces.rake
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,26 @@ namespace :images do
puts "\n#{'DRY RUN: ' if dry_run}Starting image migration to DigitalOcean Spaces"
puts "=========================================================\n\n"

unless ENV['SPACES_BUCKET_IMAGES']
puts "Error: SPACES_BUCKET_IMAGES environment variable is not set."
unless ENV['SPACES_BUCKET_CONTENT']
puts "Error: SPACES_BUCKET_CONTENT environment variable is not set."
exit
end

def upload_to_spaces(file_path, key, dry_run)
if dry_run
puts " Would upload: #{file_path}"
puts " To: #{key}"
"https://#{ENV['SPACES_BUCKET_IMAGES']}.syd1.digitaloceanspaces.com/#{key}"
"https://#{ENV['SPACES_BUCKET_CONTENT']}.syd1.digitaloceanspaces.com/#{key}"
else
bucket = S3_CLIENT.bucket(ENV['SPACES_BUCKET_IMAGES'])
bucket = S3_CLIENT.bucket(ENV['SPACES_BUCKET_CONTENT'])
obj = bucket.object(key)

begin
File.open(file_path, 'rb') do |file|
obj.put(body: file, acl: 'public-read')
end
puts " Uploaded: #{key}"
"https://#{ENV['SPACES_BUCKET_IMAGES']}.syd1.digitaloceanspaces.com/#{key}"
"https://#{ENV['SPACES_BUCKET_CONTENT']}.syd1.digitaloceanspaces.com/#{key}"
rescue Aws::S3::Errors::ServiceError => e
puts " Failed to upload #{key}: #{e.message}"
nil
Expand Down
Empty file modified public/avatars/default_avatar.jpg
100644 → 100755
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed public/avatars/loftwah_avatar.jpg
Binary file not shown.
Binary file added public/uploads/og_images/Deano123_og.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/uploads/og_images/dean28_og.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/uploads/og_images/testuser_og.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit a75b4fc

Please sign in to comment.