about summary refs log tree commit diff
path: root/config/initializers
diff options
context:
space:
mode:
authorThibG <thib@sitedethib.com>2018-08-21 17:53:01 +0200
committerEugen Rochko <eugen@zeonfederated.com>2018-08-21 17:53:01 +0200
commitf06fa099625e928e5858ea81a20be1eddf6c6fbb (patch)
tree7423a3f213f64b835a9415f372984cccb4b0f355 /config/initializers
parentd98de8ada743886c3cd48b2ad942d46b805af7a9 (diff)
Revert to using Paperclip's filesystem storage, and fix dangling records in remove_remote (#8339)
* Fix uncaching worker

* Revert to using Paperclip's filesystem backend instead of fog-local

fog-local has lots of concurrency issues, causing failure to delete files,
dangling file records, and spurious errors UncacheMediaWorker
Diffstat (limited to 'config/initializers')
-rw-r--r--config/initializers/paperclip.rb12
1 files changed, 4 insertions, 8 deletions
diff --git a/config/initializers/paperclip.rb b/config/initializers/paperclip.rb
index c134bc5b8..59ab9b9a1 100644
--- a/config/initializers/paperclip.rb
+++ b/config/initializers/paperclip.rb
@@ -74,14 +74,10 @@ elsif ENV['SWIFT_ENABLED'] == 'true'
     fog_public: true
   )
 else
-  require 'fog/local'
-
   Paperclip::Attachment.default_options.merge!(
-    fog_credentials: {
-      provider: 'Local',
-      local_root: ENV.fetch('PAPERCLIP_ROOT_PATH') { Rails.root.join('public', 'system') },
-    },
-    fog_directory: '',
-    fog_host: ENV.fetch('PAPERCLIP_ROOT_URL') { '/system' }
+    storage: :filesystem,
+    use_timestamp: true,
+    path: (ENV['PAPERCLIP_ROOT_PATH'] || ':rails_root/public/system') + '/:class/:attachment/:id_partition/:style/:filename',
+    url: (ENV['PAPERCLIP_ROOT_URL'] || '/system') + '/:class/:attachment/:id_partition/:style/:filename',
   )
 end